Gtk.MenuToolButton

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Actionable Gtk.Actionable GObject.GInterface->Gtk.Actionable Gtk.Activatable Gtk.Activatable GObject.GInterface->Gtk.Activatable Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.ToolButton Gtk.ToolButton Gtk.Actionable->Gtk.ToolButton Gtk.ToolItem Gtk.ToolItem Gtk.Activatable->Gtk.ToolItem Gtk.Bin Gtk.Bin Gtk.Bin->Gtk.ToolItem Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.MenuToolButton Gtk.MenuToolButton Gtk.ToolButton->Gtk.MenuToolButton Gtk.ToolItem->Gtk.ToolButton Gtk.Widget->Gtk.Container

Subclasses:None

Properties

Inherited:Gtk.ToolButton (6), Gtk.ToolItem (3), Gtk.Container (3), Gtk.Widget (39), Gtk.Activatable (2), Gtk.Actionable (2)
Name Type Flags Short Description
menu Gtk.Menu r/w The dropdown menu

Style Properties

Inherited:Gtk.ToolButton (1), Gtk.Widget (17)

Signals

Inherited:Gtk.ToolButton (1), Gtk.ToolItem (2), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name Short Description
show-menu The ::show-menu signal is emitted before the menu is shown.

Fields

Inherited:Gtk.ToolButton (1), Gtk.ToolItem (2), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name Type Access Description
parent Gtk.ToolButton r  

Class Details

class Gtk.MenuToolButton(*args, **kwargs)
Bases:Gtk.ToolButton
Abstract:No
Structure:Gtk.MenuToolButtonClass

A Gtk.MenuToolButton is a Gtk.ToolItem 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>
classmethod new(icon_widget, label)[source]
Parameters:
  • icon_widget (Gtk.Widget or None) – a widget that will be used as icon widget, or None
  • label (str or None) – a string that will be used as label, or None
Returns:

the new Gtk.MenuToolButton

Return type:

Gtk.ToolItem

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

New in version 2.6.

classmethod new_from_stock(stock_id)[source]
Parameters:stock_id (str) – the name of a stock item
Returns:the new Gtk.MenuToolButton
Return type:Gtk.ToolItem

Creates a new Gtk.MenuToolButton. The new Gtk.MenuToolButton will contain an icon and label from the stock item indicated by stock_id.

New in version 2.6.

Deprecated since version 3.10: Use Gtk.MenuToolButton.new() instead.

get_menu()[source]
Returns:the Gtk.Menu associated with Gtk.MenuToolButton
Return type:Gtk.Widget

Gets the Gtk.Menu associated with Gtk.MenuToolButton.

New in version 2.6.

set_arrow_tooltip_markup(markup)[source]
Parameters:markup (str) – markup text to be used as tooltip text for button’s arrow button

Sets the tooltip markup text to be used as tooltip for the arrow button which pops up the menu. See Gtk.ToolItem.set_tooltip_text() for setting a tooltip on the whole Gtk.MenuToolButton.

New in version 2.12.

set_arrow_tooltip_text(text)[source]
Parameters:text (str) – text to be used as tooltip text for button’s arrow button

Sets the tooltip text to be used as tooltip for the arrow button which pops up the menu. See Gtk.ToolItem.set_tooltip_text() for setting a tooltip on the whole Gtk.MenuToolButton.

New in version 2.12.

set_menu(menu)[source]
Parameters:menu (Gtk.Widget) – the Gtk.Menu associated with Gtk.MenuToolButton

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

New in version 2.6.

do_show_menu() virtual

Signal Details

Gtk.MenuToolButton.signals.show_menu(menu_tool_button)
Signal Name:show-menu
Flags:RUN_FIRST
Parameters:menu_tool_button (Gtk.MenuToolButton) – The object which received the signal

The ::show-menu signal is emitted before the menu is shown.

It can be used to populate the menu on demand, using Gtk.MenuToolButton.set_menu().

Note that even if you populate the menu dynamically in this way, you must set an empty menu on the Gtk.MenuToolButton beforehand, since the arrow is made insensitive if the menu is not set.

Property Details

Gtk.MenuToolButton.props.menu
Name:menu
Type:Gtk.Menu
Default Value:None
Flags:READABLE, WRITABLE

The dropdown menu