A (basic) cross-platform python input handler
Project description
InputHandler
A (basic) cross-platform python input handler
Table of Contents
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.
- Using python (not recommended)
- Run the following line in your terminal
python setup.py install
- To uninstall you must remove the files manually
- Run the following line in your terminal
- Using pip
- Run the following line in your terminal
pip install .
- To uninstall run
pip uninstall pyinputhandler
- Run the following line in your terminal
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyinputhandler-1.3.0.tar.gz.
File metadata
- Download URL: pyinputhandler-1.3.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b919a720b3f01e7382aad587453124ee2a6923fa2178e0346927c18de38d2cbb
|
|
| MD5 |
8ffef704336594d7819d35ed3a4d898e
|
|
| BLAKE2b-256 |
a3567993290a11da3c709b2d232f465930d732857e565f57e72cc28a3b4c0c41
|
File details
Details for the file pyinputhandler-1.3.0-py3-none-any.whl.
File metadata
- Download URL: pyinputhandler-1.3.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cd72eea49471db341a0cdc37d26db5bf2b96fac71c754af5c8e7ca0302c399e
|
|
| MD5 |
582b83ab06720db831526a8a6306f2f1
|
|
| BLAKE2b-256 |
2ac9dc799473603d0469b886c36dc67be6d8baf8edca79afca4c82a279cf62ef
|