Skip to content

DaHunterTime/InputHandler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Stars Issues Repo Size MIT License

InputHandler

A (basic) cross-platform python input handler

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. License
  5. Acknowledgements

About The Project

This project aims to implement a finer control for the input, especially when in use with threads.

It was partially inspired by aiming to be a cross-platform alternative to the get_line_buffer function from the Unix only python standard library readline.

Getting Started

For the manual installation you must have setuptools installed.

Python usually comes with setuptools, but if yours does not, then run

pip install --upgrade setuptools

Then clone the repository

git clone https://github.com/DaHunterTime/InputHandler

And move to the newly cloned folder

cd InputHandler

Installation

Manual installation:

For a manual installation you can use any of the following options.

  1. Using python (not recommended)
    • Run the following line in your terminal
      python setup.py install
    • To uninstall you must remove the files manually
  2. Using pip
    • Run the following line in your terminal
      pip install .
    • To uninstall run
      pip uninstall pyinputhandler

Pip installation:

  • To install run
    pip install pyinputhandler
  • To uninstall run
    pip uninstall pyinputhandler

Usage

To begin with, we can import the library with

import inputhandler

Or you can import specific things like buffer_input

from inputhandler import buffer_input

We can use the try_input like

from inputhandler import try_input

n = try_input("Enter an integer: ", cast=int, default=0)

The previous code will prompt the user for an integer, process the input and then turn it into an int if it can, otherwise it returns the specified default value.

For more uses and tests you can execute the specific test file from tests or run python test.py to select which test to run.

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements

None of the following are associated with the project in any way. They are mentioned as a source of learning and inspiration for parts of this project.

About

Python module for an input handler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages