Refresher UI element¶
from ui import Refresher counter = 0 def get_data(): counter += 1 return [str(counter), str(1000-counter)] #Return value will be sent directly to output.display_data Refresher(get_data, i, o, 1, name="Counter view").activate()
Refresher(refresh_function, i, o, refresh_interval=1, keymap=None, name='Refresher')¶
Implements a state where display is refreshed from time to time, updating the screen with information from a function.
__init__(refresh_function, i, o, refresh_interval=1, keymap=None, name='Refresher')¶
Initialises the Refresher object.
refresh_function: a function which returns data to be displayed on the screen upon being called, in the format accepted by
o: input&output device objects
refresh_interval: Time between display refreshes (and, accordingly,
keymap: Keymap entries you want to set while Refresher is active
name: Refresher name which can be used internally and for debugging.
A method which is called when refresher needs to start operating. Is blocking, sets up input&output devices, renders the refresher, periodically calls the refresh function&refreshes the screen while self.in_foreground is True, while refresher callbacks are executed from the input device thread.
Deactivates the refresher completely, exiting it.
A debug method. Useful for hooking up to an input event so that you can see which refresher is currently active.