Numeric input UI elements¶
from ui import IntegerAdjustInput start_from = 0 number = IntegerAdjustInput(start_from, i, o).activate() if number is None: #Input cancelled return #process the number
IntegerAdjustInput(number, i, o, message='Pick a number:', interval=1, name='IntegerAdjustInput', mode='normal', max=None, min=None)¶
Implements a simple number input dialog which allows you to increment/decrement a number using which can be used to navigate through your application, output a list of values or select actions to perform. Is one of the most used elements, used both in system core and in most of the applications.
number: The number being changed.
initial_number: The number sent to the constructor. Used by reset() method.
selected_number: A flag variable to be returned by activate().
in_foreground: a flag which indicates if UI element is currently displayed. If it’s not active, inhibits any of element’s actions which can interfere with other UI element being displayed.
__init__(number, i, o, message='Pick a number:', interval=1, name='IntegerAdjustInput', mode='normal', max=None, min=None)¶
Initialises the IntegerAdjustInput object.
number: number to be operated on
o: input&output device objects
message: Message to be shown on the first line of the screen while UI element is active.
interval: Value by which the number is incremented and decremented.
name: UI element name which can be used internally and for debugging.
mode: Number display mode, either “normal” (default) or “hex” (“float” will be supported eventually)
min: minimum value, will not go lower than that.
max: maximum value, will not go higher than that.
A debug method. Useful for hooking up to an input event so that you can see current number value.
A method which is called when the UI element needs to start operating. Is blocking, sets up input&output devices, refreshes the UI element, then calls the
idle_loopmethod while the UI element is active.
self.in_foregroundis True, while callbacks are executed from the input device thread.
Deactivates the UI element, exiting it.
A debug method. Useful for hooking up to an input event so that you can see which UI element is currently active.