MenuItem#
- class ignis.widgets.Widget.MenuItem(label: str, enabled: bool = True, on_activate: Callable | None = None, submenu: Gtk.PopoverMenu | None = None)#
Bases:
IgnisGObject
Danger
This is not a regular widget. It doesn't support common widget properties and cannot be added as a child to a container.
A class that represent a menu item. Intended for use in
PopoverMenu
.- Parameters:
label -- The label of item.
enabled (default:
True
) -- Whether the item is enabled. IfFalse
, the item cannot be selected.on_activate (default:
None
) -- The function to call when the user clicks on the item.submenu (default:
None
) -- ThePopoverMenu
that will appear when activated.
Widget.MenuItem( label="item 1", enabled=True, on_activate=lambda x: print("menu item 1 activated!"), submenu=Widget.PopoverMenu() )
- gproperty enabled: bool#
read-only
Whether the item is enabled. If
False
, the item cannot be selected.
- gproperty submenu: Gtk.PopoverMenu | None#
read-only
The
PopoverMenu
that will appear when activated.