Selection#

Availability (Key)#

macOS

GTK

Windows

iOS

Android

Web

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

../../../_images/Selection.jpeg

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 of str) – The items for the selection.

MIN_WIDTH = 100#
property items#

The list of items.

Returns:

The list of str 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.