IO Extention
Project description
Advanced Input
Advanced input for python, where you can read in just one character or have inputs priority ordered.
Usage
from advanced-input import get_advanced_input, PriorityOrder
from threading import Thread
from time import sleep
input_handler = get_advanced_input()
def thread_one():
user_input = input_handler.input(priority=PriorityOrder.High)
print(user_input)
def main():
backgroundThread = Thread(target=thread_one)
backgroundThread.start()
sleep(.1)
input_handler.read("Press any character to exit...", PriorityOrder.Low)
input_handler.stop()
This will result in a user input for thread_one
being created before the main
function's exit will be available. Normally, this would result in the program exiting, before accepting the user input of thread_one
. With this, thread one will be in a higher priority than main
, and that will be the first to be served the user's input. Additionally, Read()
returns when one character is pressed.
If there are multiple inputs with the same priority, it will return them in a first come last serve method.
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
advanced_input-0.1.1.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for advanced_input-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebe8efc9ca15e2b775416f350cf0479a88b6bed752ccb22b9a2b23b87f538b46 |
|
MD5 | 391e832a02c706606be850266eee58fa |
|
BLAKE2b-256 | 64bdf22d359c6416ba59454706cc929e8c0ddee957f91af04a0779e4038f193f |