TUIX v0.5Beta
Choice Widget
Choice renders a selectable option list. The frame loop handles keyboard navigation and confirmation for normal v0.5 apps.
Creating A Choice Widget
uid = objects.create_object(builders.CHOICE, 'Main', 0.4, 0.35, 0.2, 0.3)
choice = objects.get_object_by_uid(uid)
objects.tuix_choice_set_options(choice, ['Yes', 'No', 'Maybe'])
scenes.set_focus('Main', uid)API Functions
| Function | Description |
|---|---|
| objects.tuix_choice_set_options(obj, labels) | Sets option labels. labels can be bytes or str values. |
| objects.tuix_choice_is_confirmed(obj) | Returns non-zero after Enter/activation. |
| objects.tuix_choice_get_result(obj) | Returns the confirmed option index. |
| objects.tuix_choice_get_selected(obj) | Returns the currently highlighted option index. |
| objects.tuix_choice_reset(obj) | Clears confirmation state. |
| objects.tuix_choice_feed_input(obj, snap) | Compatibility helper; not required in normal frame-loop usage. |
Loop Pattern
while True:
engine.main_loop()
if objects.tuix_choice_is_confirmed(choice):
selected = objects.tuix_choice_get_result(choice)
break