Skip to main content

A (basic) cross-platform python input handler

Project description

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.

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

pyinputhandler-1.3.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

pyinputhandler-1.3.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

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

Hashes for pyinputhandler-1.3.0.tar.gz
Algorithm Hash digest
SHA256 b919a720b3f01e7382aad587453124ee2a6923fa2178e0346927c18de38d2cbb
MD5 8ffef704336594d7819d35ed3a4d898e
BLAKE2b-256 a3567993290a11da3c709b2d232f465930d732857e565f57e72cc28a3b4c0c41

See more details on using hashes here.

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

Hashes for pyinputhandler-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7cd72eea49471db341a0cdc37d26db5bf2b96fac71c754af5c8e7ca0302c399e
MD5 582b83ab06720db831526a8a6306f2f1
BLAKE2b-256 2ac9dc799473603d0469b886c36dc67be6d8baf8edca79afca4c82a279cf62ef

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page