Character input UI elements¶
from ui import CharArrowKeysInput password = CharArrowKeysInput(i, o, message="Password:", name="My password dialog").activate() if password is None: #UI element exited return False #Cancelling #processing the input you received...
CharArrowKeysInput(i, o, message='Value:', value='', allowed_chars=['][S', '][c', '][C', '][s', '][n'], name='CharArrowKeysInput', initial_value='')¶
Implements a character input dialog which allows to input a character string using arrow keys to scroll through characters
__init__(i, o, message='Value:', value='', allowed_chars=['][S', '][c', '][C', '][s', '][n'], name='CharArrowKeysInput', initial_value='')¶
Initialises the CharArrowKeysInput object.
o: input&output device objects
value: Value to be edited. If not set, will start with an empty string.
allowed_chars: Characters to be used during input. Is a list of strings designating ranges which can be the following:
- ‘][c’ for lowercase ASCII characters
- ‘][C’ for uppercase ASCII characters
- ‘][s’ for special characters
- ‘][S’ for space
- ‘][n’ for numbers
- ‘][h’ for hexadecimal characters (0-F)
If a string does not designate a range of characters, it’ll be added to character map as-is.
message: Message to be shown in the first row of the display
name: UI element name which can be used internally and for debugging.
A method which is called when input element needs to start operating. Is blocking, sets up input&output devices, renders the element and waits until self.in_background is False, while menu callbacks are executed from the input device thread. This method returns the selected value if KEY_ENTER was pressed, thus accepting the selection. This method returns None when the UI element was exited by KEY_LEFT and thus the value was not accepted.
Deactivates the UI element, exiting it and thus making activate() return.
A debug method. Useful for hooking up to an input event so that you can see current value.
A debug method. Useful for hooking up to an input event so that you can see which UI element is currently processing input events.
Changes the current character to the next character in the charmap
Changes the current character to the previous character in the charmap
Moves cursor to the next element.
Moves cursor to the previous element. If first element is chosen, exits and makes the element return None.
Selects the currently active number value, making activate() return it.