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?
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)

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-0.9.tar.gz (2.5 kB view hashes)

Uploaded Source

Built Distribution

TimedInputPy-0.9-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

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