Catalog PyPI
Back to packageRELEASE DETAILS

0.2.2

PyPI

advanced-input

IO Extention

Published1 May 2024
Direct dependencies0
Transitive dependenciesNot calculated

README

Version 0.2.2 documentation

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.

Windows quirks

Due to how Windows works with new line (\r\n), on Windows it is not possible to read the "Carriage Return" (\r) character. It will always return "Line Feed" (\n) instead. Due to how Windows console works, the default (utf-8) encoding input will not work with some special character. For it to work, please specify the encoding of your system.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 0

Native requirements
0 direct targetsNot calculated transitive count
No declared dependencies in this collected response

Declarations describe requirements; they are not a resolved dependency graph.

Distribution files

2 collected
advanced_input-0.2.2-py3-none-any.whl

bdist_wheel · 42.65 KB · Python py3

Source file
advanced_input-0.2.2.tar.gz

sdist · 42.56 KB · Python source

Source file

Repository

PENDING
nightkey/advanced-input

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:58 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:f6b2ca15c5eaef851a8e2e670c92f4769a5adc3c9cc79afa14a0362e683608df

Other collected versions

View all collected versions →