Gtk.PopoverMenu¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | Gtk.Popover (19), Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10) | 
|---|---|
| Structs: | Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5) | 
| class | new() | 
| open_submenu(name) | 
Virtual Methods¶
| Inherited: | Gtk.Popover (1), Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10) | 
|---|
Properties¶
| Inherited: | Gtk.Popover (6), Gtk.Container (3), Gtk.Widget (39) | 
|---|
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| visible-submenu | str | r/w | The name of the visible submenu | 
Child Properties¶
| Name | Type | Default | Flags | Short Description | 
|---|---|---|---|---|
| position | int | 0 | r/w | The index of the child in the parent | 
| submenu | str | None | r/w | The name of the submenu | 
Style Properties¶
| Inherited: | Gtk.Widget (17) | 
|---|
Signals¶
| Inherited: | Gtk.Popover (1), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1) | 
|---|
Fields¶
| Inherited: | Gtk.Popover (1), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1) | 
|---|
Class Details¶
- 
class Gtk.PopoverMenu(**kwargs)¶
- Bases: - Gtk.Popover- Abstract: - No - Structure: - Gtk.PopoverMenuClass- Gtk.PopoverMenuis a subclass of- Gtk.Popoverthat treats its children like menus and allows switching between them. It is meant to be used primarily together with- Gtk.ModelButton, but any widget can be used, such as- Gtk.SpinButtonor- Gtk.Scale. In this respect,- Gtk.PopoverMenuis more flexible than popovers that are created from a- Gio.MenuModelwith- Gtk.Popover.new_from_model().- To add a child as a submenu, set the - Gtk.PopoverMenu- :submenuchild property to the name of the submenu. To let the user open this submenu, add a- Gtk.ModelButtonwhose- Gtk.ModelButton- :menu-nameproperty is set to the name you’ve given to the submenu.- By convention, the first child of a submenu should be a - Gtk.ModelButtonto switch back to the parent menu. Such a button should use the- Gtk.ModelButton- :invertedand- Gtk.ModelButton- :centeredproperties to achieve a title-like appearance and place the submenu indicator at the opposite side. To switch back to the main menu, use “main” as the menu name.- Example
 - <object class="GtkPopoverMenu"> <child> <object class="GtkBox"> <property name="visible">True</property> <property name="margin">10</property> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="action-name">win.frob</property> <property name="text" translatable="yes">Frob</property> </object> </child> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="menu-name">more</property> <property name="text" translatable="yes">More</property> </object> </child> </object> </child> <child> <object class="GtkBox"> <property name="visible">True</property> <property name="margin">10</property> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="action-name">win.foo</property> <property name="text" translatable="yes">Foo</property> </object> </child> <child> <object class="GtkModelButton"> <property name="visible">True</property> <property name="action-name">win.bar</property> <property name="text" translatable="yes">Bar</property> </object> </child> </object> <packing> <property name="submenu">more</property> </packing> </child> </object>- Just like normal popovers created using - Gtk.Popover.new_from_model,- Gtk.PopoverMenuinstances have a single css node called “popover” and get the .menu style class.- 
classmethod new()[source]¶
- Returns: - a new - Gtk.PopoverMenu- Return type: - Gtk.Widget- Creates a new popover menu. - New in version 3.16. 
 - 
open_submenu(name)[source]¶
- Parameters: - name ( - str) – the name of the menu to switch to- Opens a submenu of the self. The name must be one of the names given to the submenus of self with - Gtk.PopoverMenu- :submenu, or “main” to switch back to the main menu.- Gtk.ModelButtonwill open submenus automatically when the- Gtk.ModelButton- :menu-nameproperty is set, so this function is only needed when you are using other kinds of widgets to initiate menu changes.- New in version 3.16.