PopoverMenu#

class ignis.widgets.Widget.PopoverMenu(*args: Any, **kwargs: Any)#

Bases: Gtk.PopoverMenu

A dropdown menu. It must be added as a child to a container. To display it, call the popup() method.

Note

The Popover Menu points to the widget to which it was added.

Parameters:

**kwargs -- Properties to set.

from ignis.menu_model import IgnisMenuModel, IgnisMenuItem, IgnisMenuSeparator

Widget.PopoverMenu(
    model=IgnisMenuModel(
        IgnisMenuItem(
            label="Just item",
            on_activate=lambda x: print("item activated!"),
        ),
        IgnisMenuItem(
            label="This is disabled item",
            enabled=False,
            on_activate=lambda x: print(
                "you will not see this message in terminal hehehehehe"
            ),
        ),
        IgnisMenuModel(
            *(  # unpacking because items must be passed as *args
                IgnisMenuItem(
                    label=str(i),
                    on_activate=lambda x, i=i: print(f"Clicked on item {i}!"),
                )
                for i in range(10)
            ),
            label="Submenu",  # pass label as keyword argument
        ),
    ),
)
gproperty model: IgnisMenuModel | None#
  • read-write

A menu model.