Your IP : 216.73.216.48
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.Menu</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gtk-class-reference.html" title="The gtk Class Reference"><link rel="prev" href="class-gtkliststore.html" title="gtk.ListStore"><link rel="next" href="class-gtkmenubar.html" title="gtk.MenuBar"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gtk.Menu</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkliststore.html">Prev</a> </td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gtkmenubar.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gtk.Menu"><a name="class-gtkmenu"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.Menu</h2><p>gtk.Menu — a drop down menu widget.</p></div><div class="refsect1" title="Synopsis"><a name="id3785419"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.Menu</span></span>(<span class="ooclass"><span class="classname"><a class="link" href="class-gtkmenushell.html" title="gtk.MenuShell">gtk.MenuShell</a></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a class="link" href="class-gtkmenu.html#constructor-gtkmenu" title="Constructor">gtk.Menu</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--popup" title="gtk.Menu.popup">popup</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>parent_menu_shell</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>parent_menu_item</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>func</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>button</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>activate_time</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>data</code></strong></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--reposition" title="gtk.Menu.reposition">reposition</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--popdown" title="gtk.Menu.popdown">popdown</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--get-active" title="gtk.Menu.get_active">get_active</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--set-active" title="gtk.Menu.set_active">set_active</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>index</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--set-accel-group" title="gtk.Menu.set_accel_group">set_accel_group</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>accel_group</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--get-accel-group" title="gtk.Menu.get_accel_group">get_accel_group</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--set-accel-path" title="gtk.Menu.set_accel_path">set_accel_path</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>accel_path</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--get-accel-path" title="gtk.Menu.get_accel_path">get_accel_path</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--attach-to-widget" title="gtk.Menu.attach_to_widget">attach_to_widget</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>attach_widget</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>detach_func</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--detach" title="gtk.Menu.detach">detach</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--get-attach-widget" title="gtk.Menu.get_attach_widget">get_attach_widget</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--set-tearoff-state" title="gtk.Menu.set_tearoff_state">set_tearoff_state</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>torn_off</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--get-tearoff-state" title="gtk.Menu.get_tearoff_state">get_tearoff_state</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--set-title" title="gtk.Menu.set_title">set_title</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>title</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--get-title" title="gtk.Menu.get_title">get_title</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--reorder-child" title="gtk.Menu.reorder_child">reorder_child</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>child</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>position</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--set-screen" title="gtk.Menu.set_screen">set_screen</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>screen</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--attach" title="gtk.Menu.attach">attach</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>child</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>left_attach</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>right_attach</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>top_attach</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>bottom_attach</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--set-monitor" title="gtk.Menu.set_monitor">set_monitor</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>monitor_num</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--get-monitor" title="gtk.Menu.get_monitor">get_monitor</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--set-reserve-toggle-size" title="gtk.Menu.set_reserve_toggle_size">set_reserve_toggle_size</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>reserve_toggle_size</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--get-reserve-toggle-size" title="gtk.Menu.get_reserve_toggle_size">get_reserve_toggle_size</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" title="Ancestry"><a name="id3786176"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
+-- <a class="link" href="class-gtkobject.html" title="gtk.Object">gtk.Object</a>
+-- <a class="link" href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a>
+-- <a class="link" href="class-gtkcontainer.html" title="gtk.Container">gtk.Container</a>
+-- <a class="link" href="class-gtkmenushell.html" title="gtk.MenuShell">gtk.MenuShell</a>
+-- <a class="link" href="class-gtkmenu.html" title="gtk.Menu">gtk.Menu</a>
</pre></div><div class="refsect1" title="Implemented Interfaces"><a name="id3786227"></a><h2>Implemented Interfaces</h2><p>
<a class="link" href="class-gtkmenu.html" title="gtk.Menu"><code class="classname">gtk.Menu</code></a>
implements
<a class="link" href="class-gtkbuildable.html" title="gtk.Buildable"><code class="classname">gtk.Buildable</code></a>
</p></div><div class="refsect1" title="gtk.Menu Properties"><a name="properties-gtkmenu"></a><h2>gtk.Menu Properties</h2><p><a class="link" href="class-gtkobject.html#properties-gtkobject" title="gtk.Object Properties">gtk.Object Properties</a></p><p><a class="link" href="class-gtkwidget.html#properties-gtkwidget" title="gtk.Widget Properties">gtk.Widget Properties</a></p><p><a class="link" href="class-gtkcontainer.html#properties-gtkcontainer" title="gtk.Container Properties">gtk.Container Properties</a></p><p><a class="link" href="class-gtkmenushell.html#properties-gtkmenushell" title="gtk.MenuShell Properties">gtk.MenuShell Properties</a></p><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col width="1in"><col width="1in"><col width="4in"></colgroup><tbody><tr valign="top"><td valign="top">"accel-group"</td><td valign="top">Read/Write</td><td valign="top">The accel group holding accelerators for the menu.
Available in GTK+ 2.14.</td></tr><tr valign="top"><td valign="top">"accel-path"</td><td valign="top">Read/Write</td><td valign="top">An accel path used to conveniently construct accel paths of
child items. Default value: <code class="literal">None</code>.
Available in GTK+ 2.14.</td></tr><tr valign="top"><td valign="top">"active"</td><td valign="top">Read/Write</td><td valign="top">The index of the currently selected menu item, or -1 if no menu
item is selected. Allowed values: >= -1. Default value: -1.
Available in GTK+ 2.14.</td></tr><tr valign="top"><td valign="top">"attach-widget"</td><td valign="top">Read/Write</td><td valign="top">The widget the menu is attached to. Setting this property attaches
the menu without a GtkMenuDetachFunc. If you need to use a detacher,
use <code class="methodname"><a class="link" href="class-gtkmenu.html#method-gtkmenu--attach-to-widget" title="gtk.Menu.attach_to_widget">gtk.Menu.attach_to_widget</a></code>()
directly.
Available in GTK+ 2.14.</td></tr><tr valign="top"><td valign="top">"monitor"</td><td valign="top">Read/Write</td><td valign="top">The monitor the menu will be popped up on.
Allowed values: >= -1. Default value: -1.
Available in GTK+ 2.14.</td></tr><tr valign="top"><td valign="top">"reserve-toggle-size"</td><td valign="top">Read/Write</td><td valign="top">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.
Default value: <code class="literal">True</code>
Available in GTK+ 2.18.</td></tr><tr valign="top"><td valign="top">"tearoff-state"</td><td valign="top">Read-Write</td><td valign="top">If <code class="literal">True</code> the menu is torn-off. Default
value: <code class="literal">False</code>. Available in GTK+ 2.6 and above.</td></tr><tr valign="top"><td valign="top">"tearoff-title"</td><td valign="top">Read-Write</td><td valign="top">A title that may be displayed by the window manager
when this menu is torn-off. Default value: "".</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="gtk.Menu Style Properties"><a name="style-properties-gtkmenu"></a><h2>gtk.Menu Style Properties</h2><p><a class="link" href="class-gtkwidget.html#style-properties-gtkwidget" title="gtk.Widget Style Properties">gtk.Widget Style Properties</a></p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>These properties are available in GTK+ 2.4 and above.</p></div><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col width="1in"><col width="1in"><col width="4in"></colgroup><tbody><tr valign="top"><td valign="top">"arrow-placement"</td><td valign="top">Read</td><td valign="top">When the menu is a submenu, position it this number of pixels offset horizontally.
Default value: <code class="literal">gtk.ARROWS_BOTH</code>.</td></tr><tr valign="top"><td valign="top">"arrow-scaling"</td><td valign="top">Read</td><td valign="top">Arbitrary constant to scale down the size of the scroll arrow.
Allowed values: [0,1].
Default value: 0.7</td></tr><tr valign="top"><td valign="top">"double-arrows"</td><td valign="top">Read</td><td valign="top">When scrolling, always show both arrows.
Default value: <code class="literal">True</code></td></tr><tr valign="top"><td valign="top">"horizontal-offset"</td><td valign="top">Read</td><td valign="top">When the menu is a submenu, position it this number of pixels offset horizontally. Default value: -2.</td></tr><tr valign="top"><td valign="top">"horizontal-padding"</td><td valign="top">Read</td><td valign="top">Extra space at the left and right edges of the menu</td></tr><tr valign="top"><td valign="top">"vertical-offset"</td><td valign="top">Read</td><td valign="top">When the menu is a submenu, position it this number of pixels offset vertically. Default value: 0.</td></tr><tr valign="top"><td valign="top">"vertical-padding"</td><td valign="top">Read</td><td valign="top">Extra space at the top and bottom of the menu. Allowed values: >= 0. Default value: 1.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="gtk.Menu Child Properties"><a name="child-properties-gtkmenu"></a><h2>gtk.Menu Child Properties</h2><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>These properties are available in GTK+ 2.4 and above.</p></div><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col width="1in"><col width="1in"><col width="4in"></colgroup><tbody><tr valign="top"><td valign="top">"bottom-attach"</td><td valign="top">Read-Write</td><td valign="top">The row number to attach the bottom of the child
to. Allowed values: >= -1. Default value: -1.</td></tr><tr valign="top"><td valign="top">"left-attach"</td><td valign="top">Read-Write</td><td valign="top">The column number to attach the left side of the child
to. Allowed values: >= -1. Default value: -1.</td></tr><tr valign="top"><td valign="top">"right-attach"</td><td valign="top">Read-Write</td><td valign="top">The column number to attach the right side of the child
to. Allowed values: >= -1. Default value: -1.</td></tr><tr valign="top"><td valign="top">"top-attach"</td><td valign="top">Read-Write</td><td valign="top">The row number to attach the top of the child to. Allowed
values: >= -1. Default value: -1.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="gtk.Menu Signal Prototypes"><a name="signal-prototypes-gtkmenu"></a><h2>gtk.Menu Signal Prototypes</h2><p><PYGTKDOCLINK HREF="signal-prototypes-gobject">gobject.GObject Signal Prototypes</PYGTKDOCLINK></p><p><a class="link" href="class-gtkobject.html#signal-prototypes-gtkobject" title="gtk.Object Signal Prototypes">gtk.Object Signal Prototypes</a></p><p><a class="link" href="class-gtkwidget.html#signal-prototypes-gtkwidget" title="gtk.Widget Signal Prototypes">gtk.Widget Signal Prototypes</a></p><p><a class="link" href="class-gtkcontainer.html#signal-prototypes-gtkcontainer" title="gtk.Container Signal Prototypes">gtk.Container Signal Prototypes</a></p><p><a class="link" href="class-gtkmenushell.html#signal-prototypes-gtkmenushell" title="gtk.MenuShell Signal Prototypes">gtk.MenuShell Signal Prototypes</a></p><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term">"<a class="link" href="class-gtkmenu.html#signal-gtkmenu--move-scroll" title='The "move_scroll" gtk.Menu Signal'>move-scroll</a>"</span></p></td><td><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menu</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>type</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" title="Description"><a name="id3787011"></a><h2>Description</h2><p>A <a class="link" href="class-gtkmenu.html" title="gtk.Menu"><code class="classname">gtk.Menu</code></a> is a <a class="link" href="class-gtkmenushell.html" title="gtk.MenuShell"><code class="classname">gtk.MenuShell</code></a>
that implements a drop down menu consisting of a list of <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a>
objects which can be navigated and activated by the user to perform
application functions. A <a class="link" href="class-gtkmenu.html" title="gtk.Menu"><code class="classname">gtk.Menu</code></a> is most
commonly dropped down by activating a <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a> in a
<a class="link" href="class-gtkmenubar.html" title="gtk.MenuBar"><code class="classname">gtk.MenuBar</code></a>
or popped up by activating a <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a> in
another <a class="link" href="class-gtkmenu.html" title="gtk.Menu"><code class="classname">gtk.Menu</code></a>. A <a class="link" href="class-gtkmenu.html" title="gtk.Menu"><code class="classname">gtk.Menu</code></a> can also be
popped up by activating a <a class="link" href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><code class="classname">gtk.OptionMenu</code></a>.
Other composite widgets such as the <a class="link" href="class-gtknotebook.html" title="gtk.Notebook"><code class="classname">gtk.Notebook</code></a> can
pop up a <a class="link" href="class-gtkmenu.html" title="gtk.Menu"><code class="classname">gtk.Menu</code></a> as well.
Applications can display a <a class="link" href="class-gtkmenu.html" title="gtk.Menu"><code class="classname">gtk.Menu</code></a> as a popup
menu by calling the <a class="link" href="class-gtkmenu.html#method-gtkmenu--popup" title="gtk.Menu.popup"><code class="methodname">popup</code>()</a>
method.</p></div><div class="refsect1" title="Constructor"><a name="constructor-gtkmenu"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">gtk.Menu</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a <a class="link" href="class-gtkmenu.html" title="gtk.Menu"><code class="classname">gtk.Menu</code></a>
widget</td></tr></tbody></table><p>Creates a new <a class="link" href="class-gtkmenu.html" title="gtk.Menu"><code class="classname">gtk.Menu</code></a>
widget.</p></div><div class="refsect1" title="Methods"><a name="id3787199"></a><h2>Methods</h2><div class="refsect2" title="gtk.Menu.popup"><a name="method-gtkmenu--popup"></a><h3>gtk.Menu.popup</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">popup</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>parent_menu_shell</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>parent_menu_item</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>func</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>button</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>activate_time</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>data</code></strong></span><span class="initializer">=None</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>parent_menu_shell</code></strong> :</span></p></td><td>the menu shell containing the triggering menu
item or <code class="literal">None</code>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>parent_menu_item</code></strong> :</span></p></td><td>the menu item whose activation triggered the
popup or <code class="literal">None</code>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>func</code></strong> :</span></p></td><td>a user supplied function used to position the
menu or <code class="literal">None</code>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>button</code></strong> :</span></p></td><td>the mouse button which was pressed to initiate
the event. </td></tr><tr><td><p><span class="term"><strong class="parameter"><code>activate_time</code></strong> :</span></p></td><td>the time at which the activation event
occurred.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>data</code></strong> :</span></p></td><td>optional data to be passed to
<em class="parameter"><code>func</code></em></td></tr></tbody></table><p>The <code class="methodname">popup</code>() method displays a menu and
makes it available for selection. Applications can use this function
to display context-sensitive menus, and will typically supply
<code class="literal">None</code> for the
<em class="parameter"><code>parent_menu_shell</code></em>,
<em class="parameter"><code>parent_menu_item</code></em> and
<em class="parameter"><code>func</code></em> parameters. The default menu positioning
function will position the menu at the current pointer position. The
<em class="parameter"><code>button</code></em> and <em class="parameter"><code>activate_time</code></em>
values should be the mouse button that was pressed to trigger the menu
popup and the time the button was pressed. These values can usually
be retrieved from the "button_press_event".</p><p>The signature of <em class="parameter"><code>func</code></em> is:</p><pre class="programlisting">
def func(menu, user_data):
</pre><p>where <em class="parameter"><code>user_data</code></em> is
<em class="parameter"><code>data</code></em> if not
<code class="literal">None</code>. <em class="parameter"><code>func</code></em> should return a
3-tuple containing the x and y coordinates of the position to draw the
menu and a boolean that, if <code class="literal">True</code>, indicates that
the menu should be pushed in to be completely inside the screen
instead of just clamped to the size of the screen.</p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Prior to PyGTK 2.10 this method did not accept the
<em class="parameter"><code>data</code></em> parameter and the signature of
<em class="parameter"><code>func</code></em> was:</p><pre class="programlisting">
def func(menu, user_data):
</pre></div></div><div class="refsect2" title="gtk.Menu.reposition"><a name="method-gtkmenu--reposition"></a><h3>gtk.Menu.reposition</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">reposition</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">reposition</code>() method repositions the
menu on the screen according to the internal position function.</p></div><div class="refsect2" title="gtk.Menu.popdown"><a name="method-gtkmenu--popdown"></a><h3>gtk.Menu.popdown</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">popdown</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">popdown</code>() method removes the menu
from the screen.</p></div><div class="refsect2" title="gtk.Menu.get_active"><a name="method-gtkmenu--get-active"></a><h3>gtk.Menu.get_active</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_active</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a> that
was last selected in the menu. If a selection has not yet been made, the
first menu item is selected.</td></tr></tbody></table><p>The <code class="methodname">get_active</code>() method returns the
selected menu item from the menu. This is used by the <a class="link" href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><code class="classname">gtk.OptionMenu</code></a>.</p></div><div class="refsect2" title="gtk.Menu.set_active"><a name="method-gtkmenu--set-active"></a><h3>gtk.Menu.set_active</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_active</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>index</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>index</code></strong> :</span></p></td><td>the index of the menu item to select. Index
values start from 0.</td></tr></tbody></table><p>The <code class="methodname">set_active</code>() method selects the
menu item within the menu at the location specified by
<em class="parameter"><code>index</code></em>. This is used by the <a class="link" href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><code class="classname">gtk.OptionMenu</code></a>
and is not useful for applications.</p></div><div class="refsect2" title="gtk.Menu.set_accel_group"><a name="method-gtkmenu--set-accel-group"></a><h3>gtk.Menu.set_accel_group</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_accel_group</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>accel_group</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>accel_group</code></strong> :</span></p></td><td>a <a class="link" href="class-gtkaccelgroup.html" title="gtk.AccelGroup"><code class="classname">gtk.AccelGroup</code></a></td></tr></tbody></table><p>The <code class="methodname">set_accel_group</code>() method associates
the <a class="link" href="class-gtkaccelgroup.html" title="gtk.AccelGroup"><code class="classname">gtk.AccelGroup</code></a>
specified by <em class="parameter"><code>accel_group</code></em> with the menu. The
accelerator group should also be added to all windows using this menu by
calling the <a class="link" href="class-gtkwindow.html#method-gtkwindow--add-accel-group" title="gtk.Window.add_accel_group"><code class="methodname">gtk.Window.add_accel_group</code>()</a>
method.</p></div><div class="refsect2" title="gtk.Menu.get_accel_group"><a name="method-gtkmenu--get-accel-group"></a><h3>gtk.Menu.get_accel_group</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_accel_group</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the <a class="link" href="class-gtkaccelgroup.html" title="gtk.AccelGroup"><code class="classname">gtk.AccelGroup</code></a>
associated with the menu. </td></tr></tbody></table><p>The <code class="methodname">get_accel_group</code>() method returns
the <a class="link" href="class-gtkaccelgroup.html" title="gtk.AccelGroup"><code class="classname">gtk.AccelGroup</code></a>
that holds the global accelerators for the menu.</p></div><div class="refsect2" title="gtk.Menu.set_accel_path"><a name="method-gtkmenu--set-accel-path"></a><h3>gtk.Menu.set_accel_path</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_accel_path</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>accel_path</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>accel_path</code></strong> :</span></p></td><td>a valid accelerator path</td></tr></tbody></table><p>The <code class="methodname">set_accel_path</code>() method sets an
accelerator path (specified by <em class="parameter"><code>accel_path</code></em>) for this
menu to be used to construct accelerator paths for its menu items. This is a
convenience method used to avoid calling the <a class="link" href="class-gtkmenuitem.html#method-gtkmenuitem--set-accel-path" title="gtk.MenuItem.set_accel_path"><code class="methodname">gtk.MenuItem.set_accel_path</code>()</a>
method on each menu item that should support runtime user changeable
accelerators. Instead, by just calling <a class="link" href="class-gtkmenu.html#method-gtkmenu--set-accel-path" title="gtk.Menu.set_accel_path"><code class="methodname">set_accel_path</code>()</a>
on their parent, each menu item of this menu, that contains a label
describing its purpose, automatically gets an accel path assigned. For
example, calling:</p><pre class="programlisting">
menu.set_accel_path("<main>/File")
</pre><p>for a menu containing menu items "New" and "Exit", will assign
its items the accel paths: <code class="literal">"<main>/File/New"</code> and
<code class="literal">"<main>/File/Exit"</code>. Assigning accel paths to menu
items enables the user to change their accelerators at runtime.</p></div><div class="refsect2" title="gtk.Menu.get_accel_path"><a name="method-gtkmenu--get-accel-path"></a><h3>gtk.Menu.get_accel_path</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_accel_path</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the accelerator path set on the menu.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.14 and above.</p></div><p>
The <code class="methodname">get_accel_path</code>() method returns
the accelerator path set on the menu.
</p></div><div class="refsect2" title="gtk.Menu.attach_to_widget"><a name="method-gtkmenu--attach-to-widget"></a><h3>gtk.Menu.attach_to_widget</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">attach_to_widget</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>attach_widget</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>detach_func</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>attach_widget</code></strong> :</span></p></td><td>the widget that the menu will be attached
to.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>detach_func</code></strong> :</span></p></td><td>the user supplied callback function that will
be called when the menu calls the <a class="link" href="class-gtkmenu.html#method-gtkmenu--detach" title="gtk.Menu.detach"><code class="methodname">detach</code>()</a>
method.</td></tr></tbody></table><p>The <code class="methodname">attach_to_widget</code>() method attaches
the menu to the widget specified by <em class="parameter"><code>attach_widget</code></em> and
provides a callback function specified by <em class="parameter"><code>detach_func</code></em>
that will be invoked when the menu calls the <a class="link" href="class-gtkmenu.html#method-gtkmenu--detach" title="gtk.Menu.detach"><code class="methodname">detach</code>()</a>
method during its destruction. Attaching a menu to a widget associates the
menu with a widget similar to setting a parent. This is mainly used for
associating popup menus with a widget and a submenu with a menuitem.</p><p>The signature of <em class="parameter"><code>detach</code></em> is:</p><pre class="programlisting">
def detach_cb(menu, widget):
</pre><p>where <em class="parameter"><code>menu</code></em> is the
menu being detached and <em class="parameter"><code>widget</code></em> is the
<em class="parameter"><code>attach_widget</code></em>.</p><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>For historical reasons, arguments for <em class="parameter"><code>detach</code></em>
callback are swapped compared to GTK+ C API.</p></div></div><div class="refsect2" title="gtk.Menu.detach"><a name="method-gtkmenu--detach"></a><h3>gtk.Menu.detach</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">detach</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">detach</code>() method detaches the menu
from the widget to which it had been attached. See <a class="link" href="class-gtkmenu.html#method-gtkmenu--attach-to-widget" title="gtk.Menu.attach_to_widget"><code class="methodname">attach_to_widget</code>()</a>.
</p></div><div class="refsect2" title="gtk.Menu.get_attach_widget"><a name="method-gtkmenu--get-attach-widget"></a><h3>gtk.Menu.get_attach_widget</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_attach_widget</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the widget that the menu is attached
to.</td></tr></tbody></table><p>The <code class="methodname">get_attach_widget</code>() method returns
the <a class="link" href="class-gtkwidget.html" title="gtk.Widget"><code class="classname">gtk.Widget</code></a>
that the menu is attached to.</p></div><div class="refsect2" title="gtk.Menu.set_tearoff_state"><a name="method-gtkmenu--set-tearoff-state"></a><h3>gtk.Menu.set_tearoff_state</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_tearoff_state</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>torn_off</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>torn_off</code></strong> :</span></p></td><td>If <code class="literal">True</code>, the menu is
displayed as a tearoff menu.</td></tr></tbody></table><p>The <code class="methodname">set_tearoff_state</code>() method sets the
tearoff state of the menu to the value of <em class="parameter"><code>torn_off</code></em>.
If <em class="parameter"><code>torn_off</code></em> is <code class="literal">True</code> the menu is
displayed as a tearoff menu; if <em class="parameter"><code>torn_off</code></em> is
<code class="literal">False</code> the menu is displayed as a drop down menu which
persists as long as the menu is active.</p></div><div class="refsect2" title="gtk.Menu.get_tearoff_state"><a name="method-gtkmenu--get-tearoff-state"></a><h3>gtk.Menu.get_tearoff_state</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_tearoff_state</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the menu is
currently torn off.</td></tr></tbody></table><p>The <code class="methodname">get_tearoff_state</code>() method returns
whether the menu is torn off. See <a class="link" href="class-gtkmenu.html#method-gtkmenu--set-tearoff-state" title="gtk.Menu.set_tearoff_state"><code class="methodname">set_tearoff_state</code>()</a>.</p></div><div class="refsect2" title="gtk.Menu.set_title"><a name="method-gtkmenu--set-title"></a><h3>gtk.Menu.set_title</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_title</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>title</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>title</code></strong> :</span></p></td><td>a string containing the title for the
menu.</td></tr></tbody></table><p>The <code class="methodname">set_title</code>() method sets the title
text (from the value of <em class="parameter"><code>title</code></em>) to be used for the
menu when it is shown as a tearoff menu.</p></div><div class="refsect2" title="gtk.Menu.get_title"><a name="method-gtkmenu--get-title"></a><h3>gtk.Menu.get_title</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_title</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the title of the menu, or
<code class="literal">None</code> if the menu has no title set on
it.</td></tr></tbody></table><p>The <code class="methodname">get_title</code>() method returns the
title of the menu or <code class="literal">None</code> of no title is set. See <a class="link" href="class-gtkmenu.html#method-gtkmenu--set-title" title="gtk.Menu.set_title"><code class="methodname">set_title</code>()</a>.</p></div><div class="refsect2" title="gtk.Menu.reorder_child"><a name="method-gtkmenu--reorder-child"></a><h3>gtk.Menu.reorder_child</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">reorder_child</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>child</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>position</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>child</code></strong> :</span></p></td><td>the <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a> to
move.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>position</code></strong> :</span></p></td><td>the new position to place child. Positions are
numbered starting from 0</td></tr></tbody></table><p>The <code class="methodname">reorder_child</code>() method moves the
menuitem specified by <em class="parameter"><code>child</code></em> to a new position within
the menu specified by <em class="parameter"><code>position</code></em>.</p></div><div class="refsect2" title="gtk.Menu.set_screen"><a name="method-gtkmenu--set-screen"></a><h3>gtk.Menu.set_screen</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_screen</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>screen</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>screen</code></strong> :</span></p></td><td>a <a class="link" href="class-gdkscreen.html" title="gtk.gdk.Screen"><code class="classname">gtk.gdk.Screen</code></a>,
or <code class="literal">None</code> if the screen should be determined by
the widget the menu is attached to.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.2 and above.</p></div><p>The <code class="methodname">set_screen</code>() method sets the <a class="link" href="class-gdkscreen.html" title="gtk.gdk.Screen"><code class="classname">gtk.gdk.Screen</code></a>
specified by <em class="parameter"><code>screen</code></em> on which the menu will be
displayed. If <em class="parameter"><code>screen</code></em> is <code class="literal">None</code> the
screen is determined by the widget that the menu is attached to.</p></div><div class="refsect2" title="gtk.Menu.attach"><a name="method-gtkmenu--attach"></a><h3>gtk.Menu.attach</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">attach</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>child</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>left_attach</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>right_attach</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>top_attach</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>bottom_attach</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>child</code></strong> :</span></p></td><td>a <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a>.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>left_attach</code></strong> :</span></p></td><td>The column number to attach the left side of
the item to.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>right_attach</code></strong> :</span></p></td><td>The column number to attach the right side of
the item to.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>top_attach</code></strong> :</span></p></td><td>The row number to attach the top of the item
to.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>bottom_attach</code></strong> :</span></p></td><td>The row number to attach the bottom of the item
to.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <code class="methodname">attach</code>() method adds a new <a class="link" href="class-gtkmenuitem.html" title="gtk.MenuItem"><code class="classname">gtk.MenuItem</code></a>
specified by <em class="parameter"><code>child</code></em> to a (table) menu. The number of
'cells' that an item will occupy is specified by
<em class="parameter"><code>left_attach</code></em>, <em class="parameter"><code>right_attach</code></em>,
<em class="parameter"><code>top_attach</code></em> and
<em class="parameter"><code>bottom_attach</code></em>. These each represent the leftmost,
rightmost, uppermost and lower column and row numbers of the table.
(Columns and rows are indexed from zero).</p><p>Note that this function is not related to the <a class="link" href="class-gtkmenu.html#method-gtkmenu--detach" title="gtk.Menu.detach"><code class="methodname">detach()</code></a>
method.</p></div><div class="refsect2" title="gtk.Menu.set_monitor"><a name="method-gtkmenu--set-monitor"></a><h3>gtk.Menu.set_monitor</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_monitor</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>monitor_num</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>monitor_num</code></strong> :</span></p></td><td>the number of the monitor on which the menu
should be popped up</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <code class="methodname">set_monitor</code>() method informs
<code class="literal">GTK</code>+ on which monitor a menu should be popped up. See
the <a class="link" href="class-gdkscreen.html#method-gdkscreen--get-monitor-geometry" title="gtk.gdk.Screen.get_monitor_geometry"><code class="methodname">gtk.gdk.Screen.get_monitor_geometry()</code></a>
method for more information.</p><p>This method should be called from a menu positioning function 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
menu positioning function, since, for very long menus, these coordinates may
extend beyond the monitor boundaries or even the screen boundaries.</p></div><div class="refsect2" title="gtk.Menu.get_monitor"><a name="method-gtkmenu--get-monitor"></a><h3>gtk.Menu.get_monitor</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_monitor</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the number of the monitor on which the menu should
be popped up or -1, if no monitor has been set </td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.14 and above.</p></div><p>
The <code class="methodname">get_monitor</code>() method returns
the number of the monitor on which to show the menu.
</p></div><div class="refsect2" title="gtk.Menu.set_reserve_toggle_size"><a name="method-gtkmenu--set-reserve-toggle-size"></a><h3>gtk.Menu.set_reserve_toggle_size</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_reserve_toggle_size</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>reserve_toggle_size</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>reserve_toggle_size</code></strong> :</span></p></td><td><code class="literal">True</code> to reserve size for toggles.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.22 and above.</p></div><p>The <code class="methodname">set_reserve_toggle_size</code>() method sets whether the menu
should reserve space for drawing toggles or icons, regardless of their actual presence.</p></div><div class="refsect2" title="gtk.Menu.get_reserve_toggle_size"><a name="method-gtkmenu--get-reserve-toggle-size"></a><h3>gtk.Menu.get_reserve_toggle_size</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_reserve_toggle_size</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>Whether the menu reserves toggle space.</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.22 and above.</p></div><p>The <code class="methodname">get_reserve_toggle_size</code>() method returns whether the menu
reserves space for toggles and icons, regardless of their actual presence.</p></div></div><div class="refsect1" title="Signals"><a name="id3789698"></a><h2>Signals</h2><div class="refsect2" title='The "move_scroll" gtk.Menu Signal'><a name="signal-gtkmenu--move-scroll"></a><h3>The "move_scroll" gtk.Menu Signal</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>menu</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>type</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_param1</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>...</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>menu</code></em> :</span></p></td><td>the menu that received the
signal</td></tr><tr><td><p><span class="term"><em class="parameter"><code>type</code></em> :</span></p></td><td>the type of scroll that is requested</td></tr><tr><td><p><span class="term"><em class="parameter"><code>user_param1</code></em> :</span></p></td><td>the first user parameter (if any) specified
with the <PYGTKDOCLINK HREF="method-gobject--connect"><code class="methodname">connect</code>()</PYGTKDOCLINK>
method</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td>additional user parameters (if
any)</td></tr></tbody></table><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This signal is available in GTK+ 2.2 and above.</p></div><p>The "move_scroll" signal is emitted when the user attempts to
scroll the menu. <em class="parameter"><code>type</code></em> should be one of the <a class="xref" href="gtk-constants.html#gtk-scroll-step-constants" title="GTK Scroll Step Constants">GTK Scroll Step Constants</a>.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gtkliststore.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="gtk-class-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-gtkmenubar.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.ListStore </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.MenuBar</td></tr></table></div></body></html>