Command#

macOS

GTK

Windows

iOS

Android

Web

y

y

y

y

Usage#

Reference#

class toga.command.Command(action, text=NOT_PROVIDED, shortcut=None, tooltip=None, icon=None, group=None, section=None, order=None, enabled=True, factory=None, label=None)#
Parameters:
  • action – a function to invoke when the command is activated.

  • text – caption for the command.

  • shortcut – (optional) a key combination that can be used to invoke the command.

  • tooltip – (optional) a short description for what the command will do.

  • icon – (optional) a path to an icon resource to decorate the command.

  • group – (optional) a Group object describing a collection of similar commands. If no group is specified, a default “Command” group will be used.

  • section – (optional) an integer providing a sub-grouping. If no section is specified, the command will be allocated to section 0 within the group.

  • order – (optional) an integer indicating where a command falls within a section. If a Command doesn’t have an order, it will be sorted alphabetically by text within its section.

  • enabled – whether to enable the command or not.

bind(factory=None)#
property enabled#
property icon#

The Icon for the app.

Returns:

A toga.Icon instance for the app’s icon.

property key#

A unique tuple describing the path to this command

property label#

Command text.

DEPRECATED: renamed as text

Returns:

The command text as a str