Gtk.Menu

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface 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.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.MenuShell Gtk.MenuShell Gtk.Container->Gtk.MenuShell Gtk.Menu Gtk.Menu Gtk.MenuShell->Gtk.Menu Gtk.Widget->Gtk.Container

Subclasses:

Gtk.RecentChooserMenu

Methods

Inherited:

Gtk.MenuShell (14), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

get_for_attach_widget (widget)

class

new ()

class

new_from_model (model)

attach (child, left_attach, right_attach, top_attach, bottom_attach)

attach_to_widget (attach_widget, detacher)

detach ()

get_accel_group ()

get_accel_path ()

get_active ()

get_attach_widget ()

get_monitor ()

get_reserve_toggle_size ()

get_tearoff_state ()

get_title ()

place_on_monitor (monitor)

popdown ()

popup (parent_menu_shell, parent_menu_item, func, data, button, activate_time)

popup_at_pointer (trigger_event)

popup_at_rect (rect_window, rect, rect_anchor, menu_anchor, trigger_event)

popup_at_widget (widget, widget_anchor, menu_anchor, trigger_event)

popup_for_device (device, parent_menu_shell, parent_menu_item, func, data, button, activate_time)

reorder_child (child, position)

reposition ()

set_accel_group (accel_group)

set_accel_path (accel_path)

set_active (index)

set_monitor (monitor_num)

set_reserve_toggle_size (reserve_toggle_size)

set_screen (screen)

set_tearoff_state (torn_off)

set_title (title)

Virtual Methods

Inherited:

Gtk.MenuShell (9), Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

Properties

Inherited:

Gtk.MenuShell (1), Gtk.Container (3), Gtk.Widget (39)

Name

Type

Flags

Short Description

accel-group

Gtk.AccelGroup

r/w

The accel group holding accelerators for the menu

accel-path

str

r/w

An accel path used to conveniently construct accel paths of child items

active

int

r/w

The currently selected menu item

anchor-hints

Gdk.AnchorHints

r/w/c/en

Positioning hints for when the menu might fall off-screen

attach-widget

Gtk.Widget

r/w

The widget the menu is attached to

menu-type-hint

Gdk.WindowTypeHint

r/w/c/en

Menu window type hint

monitor

int

r/w/en

The monitor the menu will be popped up on

rect-anchor-dx

int

r/w/c/en

Rect anchor horizontal offset

rect-anchor-dy

int

r/w/c/en

Rect anchor vertical offset

reserve-toggle-size

bool

r/w/en

A boolean that indicates whether the menu reserves space for toggles and icons

tearoff-state

bool

d/r/w

A boolean that indicates whether the menu is torn-off deprecated

tearoff-title

str

d/r/w

A title that may be displayed by the window manager when this menu is torn-off deprecated

Child Properties

Name

Type

Default

Flags

Short Description

bottom-attach

int

-1

r/w

The row number to attach the bottom of the child to

left-attach

int

-1

r/w

The column number to attach the left side of the child to

right-attach

int

-1

r/w

The column number to attach the right side of the child to

top-attach

int

-1

r/w

The row number to attach the top of the child to

Style Properties

Inherited:

Gtk.Widget (17)

Name

Type

Default

Flags

Short Description

arrow-placement

Gtk.ArrowPlacement

Gtk.ArrowPlacement.BOTH

d/r

Indicates where scroll arrows should be placed deprecated

arrow-scaling

float

0.699999988079071

d/r

Arbitrary constant to scale down the size of the scroll arrow deprecated

double-arrows

bool

True

d/r

When scrolling, always show both arrows. deprecated

horizontal-offset

int

-2

r

When the menu is a submenu, position it this number of pixels offset horizontally

horizontal-padding

int

0

d/r

Extra space at the left and right edges of the menu deprecated

vertical-offset

int

0

r

When the menu is a submenu, position it this number of pixels offset vertically

vertical-padding

int

1

d/r

Extra space at the top and bottom of the menu deprecated

Signals

Inherited:

Gtk.MenuShell (8), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Short Description

move-scroll

popped-up

Emitted when the position of menu is finalized after being popped up using Gtk.Menu.popup_at_rect (), Gtk.Menu.popup_at_widget (), or Gtk.Menu.popup_at_pointer ().

Fields

Inherited:

Gtk.MenuShell (8), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Type

Access

Description

menu_shell

Gtk.MenuShell

r

Class Details

class Gtk.Menu(**kwargs)
Bases:

Gtk.MenuShell

Abstract:

No

Structure:

Gtk.MenuClass

A Gtk.Menu is a Gtk.MenuShell that implements a drop down menu consisting of a list of Gtk.MenuItem objects which can be navigated and activated by the user to perform application functions.

A Gtk.Menu is most commonly dropped down by activating a Gtk.MenuItem in a Gtk.MenuBar or popped up by activating a Gtk.MenuItem in another Gtk.Menu.

A Gtk.Menu can also be popped up by activating a Gtk.ComboBox. Other composite widgets such as the Gtk.Notebook can pop up a Gtk.Menu as well.

Applications can display a Gtk.Menu as a popup menu by calling the Gtk.Menu.popup() function. The example below shows how an application can pop up a menu when the 3rd mouse button is pressed.

Connecting the popup signal handler.
// connect our handler which will popup the menu
  g_signal_connect_swapped (window, "button_press_event",
G_CALLBACK (my_popup_handler), menu);
Signal handler which displays a popup menu.
static gint
my_popup_handler (GtkWidget *widget, GdkEvent *event)
{
  GtkMenu *menu;
  GdkEventButton *event_button;

  g_return_val_if_fail (widget != NULL, FALSE);
  g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
  g_return_val_if_fail (event != NULL, FALSE);

  // The "widget" is the menu that was supplied when
  // g_signal_connect_swapped() was called.
  menu = GTK_MENU (widget);

  if (event->type == GDK_BUTTON_PRESS)
    {
      event_button = (GdkEventButton *) event;
      if (event_button->button == GDK_BUTTON_SECONDARY)
        {
          gtk_menu_popup (menu, NULL, NULL, NULL, NULL,
                          event_button->button, event_button->time);
          return TRUE;
        }
    }

  return FALSE;
}
CSS nodes
menu
├── arrow.top
├── <child>
┊
├── <child>
╰── arrow.bottom

The main CSS node of Gtk.Menu has name menu, and there are two subnodes with name arrow, for scrolling menu arrows. These subnodes get the .top and .bottom style classes.

classmethod get_for_attach_widget(widget)[source]
Parameters:

widget (Gtk.Widget) – a Gtk.Widget

Returns:

the list of menus attached to his widget.

Return type:

[Gtk.Widget]

Returns a list of the menus which are attached to this widget. This list is owned by GTK+ and must not be modified.

New in version 2.6.

classmethod new()[source]
Returns:

a new Gtk.Menu

Return type:

Gtk.Widget

Creates a new Gtk.Menu

classmethod new_from_model(model)[source]
Parameters:

model (Gio.MenuModel) – a Gio.MenuModel

Returns:

a new Gtk.Menu

Return type:

Gtk.Widget

Creates a Gtk.Menu and populates it with menu items and submenus according to model.

The created menu items are connected to actions found in the Gtk.ApplicationWindow to which the menu belongs - typically by means of being attached to a widget (see Gtk.Menu.attach_to_widget()) that is contained within the Gtk.ApplicationWindows widget hierarchy.

Actions can also be added using Gtk.Widget.insert_action_group() on the menu’s attach widget or on any of its parent widgets.

New in version 3.4.

attach(child, left_attach, right_attach, top_attach, bottom_attach)[source]
Parameters:
  • child (Gtk.Widget) – a Gtk.MenuItem

  • left_attach (int) – The column number to attach the left side of the item to

  • right_attach (int) – The column number to attach the right side of the item to

  • top_attach (int) – The row number to attach the top of the item to

  • bottom_attach (int) – The row number to attach the bottom of the item to

Adds a new Gtk.MenuItem to a (table) menu. The number of “cells” that an item will occupy is specified by left_attach, right_attach, top_attach and bottom_attach. These each represent the leftmost, rightmost, uppermost and lower column and row numbers of the table. (Columns and rows are indexed from zero).

Note that this function is not related to Gtk.Menu.detach().

New in version 2.4.

attach_to_widget(attach_widget, detacher)[source]
Parameters:

Attaches the menu to the widget and provides a callback function that will be invoked when the menu calls Gtk.Menu.detach() during its destruction.

If the menu is attached to the widget then it will be destroyed when the widget is destroyed, as if it was a child widget. An attached menu will also move between screens correctly if the widgets moves between screens.

detach()[source]

Detaches the menu from the widget to which it had been attached. This function will call the callback function, detacher, provided when the Gtk.Menu.attach_to_widget() function was called.

get_accel_group()[source]
Returns:

the Gtk.AccelGroup associated with the menu

Return type:

Gtk.AccelGroup

Gets the Gtk.AccelGroup which holds global accelerators for the menu. See Gtk.Menu.set_accel_group().

get_accel_path()[source]
Returns:

the accelerator path set on the menu.

Return type:

str

Retrieves the accelerator path set on the menu.

New in version 2.14.

get_active()[source]
Returns:

the Gtk.MenuItem that was last selected in the menu. If a selection has not yet been made, the first menu item is selected.

Return type:

Gtk.Widget

Returns the selected menu item from the menu. This is used by the Gtk.ComboBox.

get_attach_widget()[source]
Returns:

the Gtk.Widget that the menu is attached to

Return type:

Gtk.Widget

Returns the Gtk.Widget that the menu is attached to.

get_monitor()[source]
Returns:

the number of the monitor on which the menu should be popped up or -1, if no monitor has been set

Return type:

int

Retrieves the number of the monitor on which to show the menu.

New in version 2.14.

get_reserve_toggle_size()[source]
Returns:

Whether the menu reserves toggle space

Return type:

bool

Returns whether the menu reserves space for toggles and icons, regardless of their actual presence.

New in version 2.18.

get_tearoff_state()[source]
Returns:

True if the menu is currently torn off.

Return type:

bool

Returns whether the menu is torn off. See Gtk.Menu.set_tearoff_state().

Deprecated since version 3.10.

get_title()[source]
Returns:

the title of the menu, or None if the menu has no title set on it. This string is owned by GTK+ and should not be modified or freed.

Return type:

str

Returns the title of the menu. See Gtk.Menu.set_title().

Deprecated since version 3.10.

place_on_monitor(monitor)[source]
Parameters:

monitor (Gdk.Monitor) – the monitor to place the menu on

Places self on the given monitor.

New in version 3.22.

popdown()[source]

Removes the menu from the screen.

popup(parent_menu_shell, parent_menu_item, func, data, button, activate_time)[source]
Parameters:
  • parent_menu_shell (Gtk.Widget or None) – the menu shell containing the triggering menu item, or None

  • parent_menu_item (Gtk.Widget or None) – the menu item whose activation triggered the popup, or None

  • func (Gtk.MenuPositionFunc or None) – a user supplied function used to position the menu, or None

  • data (object or None) – user supplied data to be passed to func.

  • button (int) – the mouse button which was pressed to initiate the event.

  • activate_time (int) – the time at which the activation event occurred.

Displays a menu and makes it available for selection.

Applications can use this function to display context-sensitive menus, and will typically supply None for the parent_menu_shell, parent_menu_item, func and data parameters. The default menu positioning function will position the menu at the current mouse cursor position.

The button parameter should be the mouse button pressed to initiate the menu popup. If the menu popup was initiated by something other than a mouse button press, such as a mouse button release or a keypress, button should be 0.

The activate_time parameter is used to conflict-resolve initiation of concurrent requests for mouse/keyboard grab requests. To function properly, this needs to be the timestamp of the user event (such as a mouse click or key press) that caused the initiation of the popup. Only if no such event is available, Gtk.get_current_event_time() can be used instead.

Note that this function does not work very well on GDK backends that do not have global coordinates, such as Wayland or Mir. You should probably use one of the gtk_menu_popup_at_ variants, which do not have this problem.

Deprecated since version 3.22: Please use Gtk.Menu.popup_at_widget(), Gtk.Menu.popup_at_pointer(). or Gtk.Menu.popup_at_rect() instead

popup_at_pointer(trigger_event)[source]
Parameters:

trigger_event (Gdk.Event or None) – the Gdk.Event that initiated this request or None if it’s the current event

Displays self and makes it available for selection.

See Gtk.Menu.popup_at_widget () to pop up a menu at a widget. Gtk.Menu.popup_at_rect () also allows you to position a menu at an arbitrary rectangle.

self will be positioned at the pointer associated with trigger_event.

Properties that influence the behaviour of this function are Gtk.Menu :anchor-hints, Gtk.Menu :rect-anchor-dx, Gtk.Menu :rect-anchor-dy, and Gtk.Menu :menu-type-hint. Connect to the Gtk.Menu ::popped-up signal to find out how it was actually positioned.

New in version 3.22.

popup_at_rect(rect_window, rect, rect_anchor, menu_anchor, trigger_event)[source]
Parameters:

Displays self and makes it available for selection.

See Gtk.Menu.popup_at_widget () and Gtk.Menu.popup_at_pointer (), which handle more common cases for popping up menus.

self will be positioned at rect, aligning their anchor points. rect is relative to the top-left corner of rect_window. rect_anchor and menu_anchor determine anchor points on rect and self to pin together. self can optionally be offset by Gtk.Menu :rect-anchor-dx and Gtk.Menu :rect-anchor-dy.

Anchors should be specified under the assumption that the text direction is left-to-right; they will be flipped horizontally automatically if the text direction is right-to-left.

Other properties that influence the behaviour of this function are Gtk.Menu :anchor-hints and Gtk.Menu :menu-type-hint. Connect to the Gtk.Menu ::popped-up signal to find out how it was actually positioned.

New in version 3.22.

popup_at_widget(widget, widget_anchor, menu_anchor, trigger_event)[source]
Parameters:
  • widget (Gtk.Widget) – the Gtk.Widget to align self with

  • widget_anchor (Gdk.Gravity) – the point on widget to align with self's anchor point

  • menu_anchor (Gdk.Gravity) – the point on self to align with widget's anchor point

  • trigger_event (Gdk.Event or None) – the Gdk.Event that initiated this request or None if it’s the current event

Displays self and makes it available for selection.

See Gtk.Menu.popup_at_pointer () to pop up a menu at the master pointer. Gtk.Menu.popup_at_rect () also allows you to position a menu at an arbitrary rectangle.

self will be positioned at widget, aligning their anchor points. widget_anchor and menu_anchor determine anchor points on widget and self to pin together. self can optionally be offset by Gtk.Menu :rect-anchor-dx and Gtk.Menu :rect-anchor-dy.

Anchors should be specified under the assumption that the text direction is left-to-right; they will be flipped horizontally automatically if the text direction is right-to-left.

Other properties that influence the behaviour of this function are Gtk.Menu :anchor-hints and Gtk.Menu :menu-type-hint. Connect to the Gtk.Menu ::popped-up signal to find out how it was actually positioned.

New in version 3.22.

popup_for_device(device, parent_menu_shell, parent_menu_item, func, data, button, activate_time)[source]
Parameters:
  • device (Gdk.Device or None) – a Gdk.Device

  • parent_menu_shell (Gtk.Widget or None) – the menu shell containing the triggering menu item, or None

  • parent_menu_item (Gtk.Widget or None) – the menu item whose activation triggered the popup, or None

  • func (Gtk.MenuPositionFunc or None) – a user supplied function used to position the menu, or None

  • data (object or None) – user supplied data to be passed to func

  • button (int) – the mouse button which was pressed to initiate the event

  • activate_time (int) – the time at which the activation event occurred

Displays a menu and makes it available for selection.

Applications can use this function to display context-sensitive menus, and will typically supply None for the parent_menu_shell, parent_menu_item, func, data and destroy parameters. The default menu positioning function will position the menu at the current position of device (or its corresponding pointer).

The button parameter should be the mouse button pressed to initiate the menu popup. If the menu popup was initiated by something other than a mouse button press, such as a mouse button release or a keypress, button should be 0.

The activate_time parameter is used to conflict-resolve initiation of concurrent requests for mouse/keyboard grab requests. To function properly, this needs to be the time stamp of the user event (such as a mouse click or key press) that caused the initiation of the popup. Only if no such event is available, Gtk.get_current_event_time() can be used instead.

Note that this function does not work very well on GDK backends that do not have global coordinates, such as Wayland or Mir. You should probably use one of the gtk_menu_popup_at_ variants, which do not have this problem.

New in version 3.0.

Deprecated since version 3.22: Please use Gtk.Menu.popup_at_widget(), Gtk.Menu.popup_at_pointer(). or Gtk.Menu.popup_at_rect() instead

reorder_child(child, position)[source]
Parameters:
  • child (Gtk.Widget) – the Gtk.MenuItem to move

  • position (int) – the new position to place child. Positions are numbered from 0 to n - 1

Moves child to a new position in the list of self children.

reposition()[source]

Repositions the menu according to its position function.

set_accel_group(accel_group)[source]
Parameters:

accel_group (Gtk.AccelGroup or None) – the Gtk.AccelGroup to be associated with the menu.

Set the Gtk.AccelGroup which holds global accelerators for the menu. This accelerator group needs to also be added to all windows that this menu is being used in with Gtk.Window.add_accel_group(), in order for those windows to support all the accelerators contained in this group.

set_accel_path(accel_path)[source]
Parameters:

accel_path (str or None) – a valid accelerator path, or None to unset the path

Sets an accelerator path for this menu from which accelerator paths for its immediate children, its menu items, can be constructed. The main purpose of this function is to spare the programmer the inconvenience of having to call Gtk.MenuItem.set_accel_path() on each menu item that should support runtime user changable accelerators. Instead, by just calling Gtk.Menu.set_accel_path() on their parent, each menu item of this menu, that contains a label describing its purpose, automatically gets an accel path assigned.

For example, a menu containing menu items “New” and “Exit”, will, after gtk_menu_set_accel_path (menu, "<Gnumeric-Sheet>/File"); has been called, assign its items the accel paths: "<Gnumeric-Sheet>/File/New" and "<Gnumeric-Sheet>/File/Exit".

Assigning accel paths to menu items then enables the user to change their accelerators at runtime. More details about accelerator paths and their default setups can be found at Gtk.AccelMap.add_entry().

Note that accel_path string will be stored in a #GQuark. Therefore, if you pass a static string, you can save some memory by interning it first with GLib.intern_static_string().

set_active(index)[source]
Parameters:

index (int) – the index of the menu item to select. Index values are from 0 to n-1

Selects the specified menu item within the menu. This is used by the Gtk.ComboBox and should not be used by anyone else.

set_monitor(monitor_num)[source]
Parameters:

monitor_num (int) – the number of the monitor on which the menu should be popped up

Informs GTK+ on which monitor a menu should be popped up. See Gdk.Monitor.get_geometry().

This function should be called from a Gtk.MenuPositionFunc if the menu should not appear on the same monitor as the pointer. This information can’t be reliably inferred from the coordinates returned by a Gtk.MenuPositionFunc, since, for very long menus, these coordinates may extend beyond the monitor boundaries or even the screen boundaries.

New in version 2.4.

set_reserve_toggle_size(reserve_toggle_size)[source]
Parameters:

reserve_toggle_size (bool) – whether to reserve size for toggles

Sets whether the menu should reserve space for drawing toggles or icons, regardless of their actual presence.

New in version 2.18.

set_screen(screen)[source]
Parameters:

screen (Gdk.Screen or None) – a Gdk.Screen, or None if the screen should be determined by the widget the menu is attached to

Sets the Gdk.Screen on which the menu will be displayed.

New in version 2.2.

set_tearoff_state(torn_off)[source]
Parameters:

torn_off (bool) – If True, menu is displayed as a tearoff menu.

Changes the tearoff state of the menu. A menu is normally displayed as drop down menu which persists as long as the menu is active. It can also be displayed as a tearoff menu which persists until it is closed or reattached.

Deprecated since version 3.10.

set_title(title)[source]
Parameters:

title (str or None) – a string containing the title for the menu, or None to inherit the title of the parent menu item, if any

Sets the title string for the menu.

The title is displayed when the menu is shown as a tearoff menu. If title is None, the menu will see if it is attached to a parent menu item, and if so it will try to use the same text as that menu item’s label.

Deprecated since version 3.10.

Signal Details

Gtk.Menu.signals.move_scroll(menu, scroll_type)
Signal Name:

move-scroll

Flags:

RUN_LAST, ACTION

Parameters:
Gtk.Menu.signals.popped_up(menu, flipped_rect, final_rect, flipped_x, flipped_y)
Signal Name:

popped-up

Flags:

RUN_FIRST

Parameters:
  • menu (Gtk.Menu) – The object which received the signal

  • flipped_rect (object or None) – the position of menu after any possible flipping or None if the backend can’t obtain it

  • final_rect (object or None) – the final position of menu or None if the backend can’t obtain it

  • flipped_x (bool) – True if the anchors were flipped horizontally

  • flipped_y (bool) – True if the anchors were flipped vertically

Emitted when the position of menu is finalized after being popped up using Gtk.Menu.popup_at_rect (), Gtk.Menu.popup_at_widget (), or Gtk.Menu.popup_at_pointer ().

menu might be flipped over the anchor rectangle in order to keep it on-screen, in which case flipped_x and flipped_y will be set to True accordingly.

flipped_rect is the ideal position of menu after any possible flipping, but before any possible sliding. final_rect is flipped_rect, but possibly translated in the case that flipping is still ineffective in keeping menu on-screen.

The blue menu is menu's ideal position, the green menu is flipped_rect, and the red menu is final_rect.

See Gtk.Menu.popup_at_rect (), Gtk.Menu.popup_at_widget (), Gtk.Menu.popup_at_pointer (), Gtk.Menu :anchor-hints, Gtk.Menu :rect-anchor-dx, Gtk.Menu :rect-anchor-dy, and Gtk.Menu :menu-type-hint.

New in version 3.22.

Property Details

Gtk.Menu.props.accel_group
Name:

accel-group

Type:

Gtk.AccelGroup

Default Value:

None

Flags:

READABLE, WRITABLE

The accel group holding accelerators for the menu.

New in version 2.14.

Gtk.Menu.props.accel_path
Name:

accel-path

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

An accel path used to conveniently construct accel paths of child items.

New in version 2.14.

Gtk.Menu.props.active
Name:

active

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE

The index of the currently selected menu item, or -1 if no menu item is selected.

New in version 2.14.

Gtk.Menu.props.anchor_hints
Name:

anchor-hints

Type:

Gdk.AnchorHints

Default Value:

Gdk.AnchorHints.FLIP_X | Gdk.AnchorHints.FLIP_Y | Gdk.AnchorHints.SLIDE_X | Gdk.AnchorHints.SLIDE_Y | Gdk.AnchorHints.RESIZE_X | Gdk.AnchorHints.RESIZE_Y | Gdk.AnchorHints.FLIP | Gdk.AnchorHints.SLIDE | Gdk.AnchorHints.RESIZE

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

Positioning hints for aligning the menu relative to a rectangle.

These hints determine how the menu should be positioned in the case that the menu would fall off-screen if placed in its ideal position.

For example, Gdk.AnchorHints.FLIP_Y will replace Gdk.Gravity.NORTH_WEST with Gdk.Gravity.SOUTH_WEST and vice versa if the menu extends beyond the bottom edge of the monitor.

See Gtk.Menu.popup_at_rect (), Gtk.Menu.popup_at_widget (), Gtk.Menu.popup_at_pointer (), Gtk.Menu :rect-anchor-dx, Gtk.Menu :rect-anchor-dy, Gtk.Menu :menu-type-hint, and Gtk.Menu ::popped-up.

New in version 3.22.

Gtk.Menu.props.attach_widget
Name:

attach-widget

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE

The widget the menu is attached to. Setting this property attaches the menu without a Gtk.MenuDetachFunc. If you need to use a detacher, use Gtk.Menu.attach_to_widget() directly.

New in version 2.14.

Gtk.Menu.props.menu_type_hint
Name:

menu-type-hint

Type:

Gdk.WindowTypeHint

Default Value:

Gdk.WindowTypeHint.POPUP_MENU

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

The Gdk.WindowTypeHint to use for the menu’s Gdk.Window.

See Gtk.Menu.popup_at_rect (), Gtk.Menu.popup_at_widget (), Gtk.Menu.popup_at_pointer (), Gtk.Menu :anchor-hints, Gtk.Menu :rect-anchor-dx, Gtk.Menu :rect-anchor-dy, and Gtk.Menu ::popped-up.

New in version 3.22.

Gtk.Menu.props.monitor
Name:

monitor

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The monitor the menu will be popped up on.

New in version 2.14.

Gtk.Menu.props.rect_anchor_dx
Name:

rect-anchor-dx

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

Horizontal offset to apply to the menu, i.e. the rectangle or widget anchor.

See Gtk.Menu.popup_at_rect (), Gtk.Menu.popup_at_widget (), Gtk.Menu.popup_at_pointer (), Gtk.Menu :anchor-hints, Gtk.Menu :rect-anchor-dy, Gtk.Menu :menu-type-hint, and Gtk.Menu ::popped-up.

New in version 3.22.

Gtk.Menu.props.rect_anchor_dy
Name:

rect-anchor-dy

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

Vertical offset to apply to the menu, i.e. the rectangle or widget anchor.

See Gtk.Menu.popup_at_rect (), Gtk.Menu.popup_at_widget (), Gtk.Menu.popup_at_pointer (), Gtk.Menu :anchor-hints, Gtk.Menu :rect-anchor-dx, Gtk.Menu :menu-type-hint, and Gtk.Menu ::popped-up.

New in version 3.22.

Gtk.Menu.props.reserve_toggle_size
Name:

reserve-toggle-size

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A boolean that indicates whether the menu reserves space for toggles and icons, regardless of their actual presence.

This property should only be changed from its default value for special-purposes such as tabular menus. Regular menus that are connected to a menu bar or context menus should reserve toggle space for consistency.

New in version 2.18.

Gtk.Menu.props.tearoff_state
Name:

tearoff-state

Type:

bool

Default Value:

False

Flags:

DEPRECATED, READABLE, WRITABLE

A boolean that indicates whether the menu is torn-off.

New in version 2.6.

Deprecated since version 3.10.

Gtk.Menu.props.tearoff_title
Name:

tearoff-title

Type:

str

Default Value:

None

Flags:

DEPRECATED, READABLE, WRITABLE

A title that may be displayed by the window manager when this menu is torn-off.

Deprecated since version 3.10.