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.2.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

pyinputhandler-1.2.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file pyinputhandler-1.2.0.tar.gz.

File metadata

  • Download URL: pyinputhandler-1.2.0.tar.gz
  • Upload date:
  • Size: 5.7 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.2.0.tar.gz
Algorithm Hash digest
SHA256 a45dc4f81a3326b434c4de71332cdf73a63dfbf3a8e10ad0142bad581be185f8
MD5 d5d5f10f572e0f4cfcdb82b90ff096d1
BLAKE2b-256 c5f8d2122eeb6ea1a679114d46044f8f041014d653143e17e5e1a9b9d4e18032

See more details on using hashes here.

File details

Details for the file pyinputhandler-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyinputhandler-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd236951d831f41712f1bb3b21f27ce09481e5c8fa1c9fe4d840b061d81722e2
MD5 9ac770ea22d5d230b852ed25605fc0d5
BLAKE2b-256 a4b6472b76286e53b1b591f2cc378ea0a8856f85df762b8f91430656c2574bd6

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