Selection#
The Selection widget is a simple control for allowing the user to choose between a list of string options.

Usage#
import toga
container = toga.Selection(items=['bob', 'jim', 'lilly'])
Reference#
- class toga.widgets.selection.Selection(id=None, style=None, items=None, on_select=None, enabled=True, factory=None)#
The Selection widget lets you pick from a defined selection of options.
- Parameters:
id (str) – An identifier for this widget.
style (
Style
) – An optional style object. If no style is provided then a new one will be created for the widget.items (
list
ofstr
) – The items for the selection.
Create a base Toga widget.
This is an abstract base class; it cannot be instantiated.
- Parameters:
id – The ID for the widget.
style – A style object. If no style is provided, a default style will be applied to the widget.
- property items#
The list of items.
- Returns:
The
list
ofstr
of all selectable items.
- property on_select#
The callable function for when a node on the Tree is selected.
- Return type:
callable
- property value#
The value of the currently selected item.
- Returns:
The selected item as a
str
.