Skip to main content

Implemenation of thread-based timed input object

Project description

TimedInputPy

TimedInputPy is a python library that provides input function/object that has a thread based time limit on input.

API

object method description
TimedInput(timeout, prompt, default Timed input reader:
timeout -> how long to wait?
prompt -> what to ask?
default -> what to sat when timeout happens?
action -> action callback to perform when timeout happens
get_input() Function to be used as input reader
read() Reads the input from the reader
timed_input(timeout, prompt, default) Function for reading timed input, arguments same as above

Example usage

# Sample usage:
if __name__ == '__main__':
    test_timeout = 5
    test_prompt = 'Enter name: '
    test_default = 'world'

    # As a method
    s = timed_input(test_timeout, test_prompt, test_default)
    print('Hello {}!'.format(s), flush=True)

    print()

    # As a class
    s = TimedInput(test_timeout, test_prompt, test_default).read()
    print('Hello {}!'.format(s), flush=True)

Instalation

Module can be installed using pip3: pip3 install TimedInputPy

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

timedinputpy-1.0.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

TimedInputPy-1.0.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file timedinputpy-1.0.1.tar.gz.

File metadata

  • Download URL: timedinputpy-1.0.1.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.6

File hashes

Hashes for timedinputpy-1.0.1.tar.gz
Algorithm Hash digest
SHA256 256769165fdedddc3e7001207aa924c105c732c94c6ac0dd87bf12372084c80b
MD5 d30e136b26d4729296dce5ec271b5b59
BLAKE2b-256 e46e8829b38c63e2ce80984c0d3ebd6bc08ebd780bcaa4de90f7ca24faa1368b

See more details on using hashes here.

File details

Details for the file TimedInputPy-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for TimedInputPy-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 198fe4b3b2903ad083ce1106de0d9f3c438e94baf38e54b0be6b93f1f74bb0b2
MD5 1de3ffdd256b1bde6804a526cbb5c10b
BLAKE2b-256 641e7099e1e051dfe8e375e0ee94df3a55e8cb80d3bcac1b35ab72d00a366530

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