menus#

Various kinds of menus.

class ActionItem(*args: Any, id: ID | None = None, **kwargs: Any)[source]#
class CheckableItem(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

A two state checkable menu item.

class DividerItem(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

A dividing line between two groups of menu items.

class Menu(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

An implicitly positioned panel containing a collection of items.

These items can include commands, checked items, dividers, etc.

items#

A collection of menu items representing the contents of this menu.

reversed#

Whether to keep the order of menu’s items or reverse it.

class MenuItem(*args: Any, id: ID | None = None, **kwargs: Any)[source]#

A basic menu item with an icon, label, shortcut, sub-menu and an associated action.

Only label is required. All other properties are optional.

action#

An optional action (callback) associated with this item.

checked#

Whether an item is marked as checked/active.

Checked item is represented with a tick mark on the left hand side of an item. Unchecked item is represented with an empty space.

The menu will allocate a column for check marks for all its items if at least one item has set a boolean value for checked property.

disabled#

Indicates whether clicking on the item activates the associated action.

icon#

An optional icon to display left of the label.

label#

A plain text string label.

menu#

An optional sub-menu showed when hovering over this item.

shortcut#

An optional string representing the keyboard sequence triggering the action.

Note

This is only a UI hint for the user. Menus on their own don’t implement any support for triggering actions based on keyboard inputs.

tooltip#

An optional plain text description showed when hovering over this item.