Gtk.MenuToolButton


Gtk.MenuToolButton — A Gtk.ToolItem containing a button with an additional dropdown menu

Object Hierarchy:

    GObject
    ╰── GInitiallyUnowned
        ╰── Gtk.Widget
            ╰── Gtk.Container
                ╰── Gtk.Bin
                    ╰── Gtk.ToolItem
                        ╰── Gtk.ToolButton
                            ╰── Gtk.MenuToolButton

See also:

Gtk.Toolbar Gtk.ToolButton


Functions:

Description:

A Gtk.MenuToolButton is a GtkToolItem that contains a button and a small additional button with an arrow. When clicked, the arrow button pops up a dropdown menu.

Use Gtk.MenuToolButton::new() to create a new Gtk.MenuToolButton.

Gtk.MenuToolButton as Gtk.Buildable

The Gtk.MenuToolButton implementation of the Gtk.Buildable interface supports adding a menu by specifying menu as the type attribute of a <child> element.

An example for a UI definition fragment with menus:

<object class="GtkMenuToolButton">
  <child type="menu">
    <object class="GtkMenu"/>
  </child>
</object>

Function Details:

new()

new (icon_widget:Gtk.Widget=None, label:str=None) -> Gtk.ToolItem

Creates a new Gtk.MenuToolButton using icon_widget as icon andlabel as label.

  • Returns: the new Gtk.MenuToolButton

  • Since: 2.6


new_from_stock()

new_from_stock (stock_id:str) -> Gtk.ToolItem

Gtk.MenuToolButton:new_from_stock has been deprecated since version 3.10 and should not be used in newly-written code. Use Gtk.MenuToolButton:new() instead. Creates a new Gtk.MenuToolButton.The new Gtk.MenuToolButton will contain an icon and label fromthe stock item indicated by stock_id.

  • Returns: the new Gtk.MenuToolButton

  • Since: 2.6


set_menu()

set_menu (self, menu:Gtk.Widget)

Sets the Gtk.Menu that is popped up when the user clicks on the arrow.If menu is None, the arrow button becomes insensitive.

  • Since: 2.6

get_menu()

get_menu (self) -> Gtk.Widget

Gets the Gtk.Menu associated with Gtk.MenuToolButton.

  • Returns: the Gtk.Menu associatedwith Gtk.MenuToolButton.

  • Since: 2.6


set_arrow_tooltip_text()

set_arrow_tooltip_text (self, text:str)

Sets the tooltip text to be used as tooltip for the arrow button whichpops up the menu. See `Gtk.ToolItem:set_tooltip_text()for setting a tooltipon the wholeGtk.MenuToolButton`.

  • Since: 2.12

set_arrow_tooltip_markup()

set_arrow_tooltip_markup (self, markup:str)

Sets the tooltip markup text to be used as tooltip for the arrow buttonwhich pops up the menu. See `Gtk.ToolItem:set_tooltip_text()for settinga tooltip on the wholeGtk.MenuToolButton`.

  • Since: 2.12

results matching ""

    No results matching ""