~ubuntu-branches/ubuntu/natty/pygtk/natty-proposed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.OptionMenu</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"><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-gtkobject.html" title="gtk.Object"><link rel="next" href="class-gtkpagesetup.html" title="gtk.PageSetup"></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.OptionMenu</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkobject.html">Prev</a> </td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gtkpagesetup.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gtk.OptionMenu"><a name="class-gtkoptionmenu"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.OptionMenu</h2><p>gtk.OptionMenu — a widget used to provide a list of valid choices.</p></div><div class="refsect1" title="Synopsis"><a name="id3915493"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.OptionMenu</span></span>(<span class="ooclass"><span class="classname"><a class="link" href="class-gtkbutton.html" title="gtk.Button">gtk.Button</a></span></span>):
<code class="constructorsynopsis">    <span class="methodname"><a class="link" href="class-gtkoptionmenu.html#constructor-gtkoptionmenu" title="Constructor">gtk.OptionMenu</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkoptionmenu.html#method-gtkoptionmenu--get-menu" title="gtk.OptionMenu.get_menu">get_menu</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkoptionmenu.html#method-gtkoptionmenu--set-menu" title="gtk.OptionMenu.set_menu">set_menu</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>menu</code></strong></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkoptionmenu.html#method-gtkoptionmenu--remove-menu" title="gtk.OptionMenu.remove_menu">remove_menu</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkoptionmenu.html#method-gtkoptionmenu--get-history" title="gtk.OptionMenu.get_history">get_history</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkoptionmenu.html#method-gtkoptionmenu--set-history" title="gtk.OptionMenu.set_history">set_history</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>index</code></strong></span></span>)</code><br></pre></td></tr></table></div><div class="refsect1" title="Ancestry"><a name="id3915658"></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-gtkbin.html" title="gtk.Bin">gtk.Bin</a>
          +-- <a class="link" href="class-gtkbutton.html" title="gtk.Button">gtk.Button</a>
            +-- <a class="link" href="class-gtkoptionmenu.html" title="gtk.OptionMenu">gtk.OptionMenu</a>
</pre></div><div class="refsect1" title="Implemented Interfaces"><a name="id3915715"></a><h2>Implemented Interfaces</h2><p>
			<a class="link" href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><code class="classname">gtk.OptionMenu</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.OptionMenu Properties"><a name="properties-gtkoptionmenu"></a><h2>gtk.OptionMenu 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-gtkbutton.html#properties-gtkbutton" title="gtk.Button Properties">gtk.Button 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">"menu"</td><td valign="top">Read-Write</td><td valign="top">The menu of options.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="gtk.OptionMenu Style Properties"><a name="style-properties-gtkoptionmenu"></a><h2>gtk.OptionMenu 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><p><a class="link" href="class-gtkbutton.html#style-properties-gtkbutton" title="gtk.Button Style Properties">gtk.Button Style 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">"indicator-size"</td><td valign="top">Read</td><td valign="top">The size of the dropdown indicator</td></tr><tr valign="top"><td valign="top">"indicator-spacing"</td><td valign="top">Read</td><td valign="top">The spacing around the indicator.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" title="gtk.OptionMenu Signal Prototypes"><a name="signal-prototypes-gtkoptionmenu"></a><h2>gtk.OptionMenu 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-gtkbutton.html#signal-prototypes-gtkbutton" title="gtk.Button Signal Prototypes">gtk.Button 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-gtkoptionmenu.html#signal-gtkoptionmenu--changed" title='The "changed" gtk.OptionMenu Signal'>changed</a>"</span></p></td><td><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>optionmenu</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="id3916074"></a><h2>Description</h2><div class="warning" title="Warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><a class="link" href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><code class="classname">gtk.OptionMenu</code></a>
is deprecated in PyGTK 2.4; use the <a class="link" href="class-gtkcombobox.html" title="gtk.ComboBox"><code class="classname">gtk.ComboBox</code></a>
instead.</p></div><p>A <a class="link" href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><code class="classname">gtk.OptionMenu</code></a>
is a widget allows the user to choose from a list of valid choices from an
associated menu. The <a class="link" href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><code class="classname">gtk.OptionMenu</code></a>
displays the last selected choice. When activated (clicked) the <a class="link" href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><code class="classname">gtk.OptionMenu</code></a>
displays a popup <a class="link" href="class-gtkmenu.html" title="gtk.Menu"><code class="classname">gtk.Menu</code></a> which allows
the user to make a new choice. Using a <a class="link" href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><code class="classname">gtk.OptionMenu</code></a>
is simple:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">build a <a class="link" href="class-gtkmenu.html" title="gtk.Menu"><code class="classname">gtk.Menu</code></a> using <a class="link" href="class-gtkmenu.html#constructor-gtkmenu" title="Constructor"><code class="methodname">gtk.Menu</code>()</a></li><li class="listitem">then append menu items to it using <a class="link" href="class-gtkmenushell.html#method-gtkmenushell--append" title="gtk.MenuShell.append"><code class="methodname">gtk.MenuShell.append</code>()</a></li><li class="listitem">associate the menu with the option menu using <a class="link" href="class-gtkoptionmenu.html#method-gtkoptionmenu--set-menu" title="gtk.OptionMenu.set_menu"><code class="methodname">set_menu</code>()</a></li><li class="listitem">set the selected menu item with <a class="link" href="class-gtkoptionmenu.html#method-gtkoptionmenu--set-history" title="gtk.OptionMenu.set_history"><code class="methodname">set_history</code>()</a></li><li class="listitem">connect to the "changed" signal on the option menu; in the
"changed" signal</li><li class="listitem">check the new selected menu item with <a class="link" href="class-gtkoptionmenu.html#method-gtkoptionmenu--get-history" title="gtk.OptionMenu.get_history"><code class="methodname">get_history</code>()</a>.</li></ul></div></div><div class="refsect1" title="Constructor"><a name="constructor-gtkoptionmenu"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis">    <span class="methodname">gtk.OptionMenu</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 new optionmenu widget</td></tr></tbody></table><p>Creates a new <a class="link" href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><code class="classname">gtk.OptionMenu</code></a>
widget.</p></div><div class="refsect1" title="Methods"><a name="id3916305"></a><h2>Methods</h2><div class="refsect2" title="gtk.OptionMenu.get_menu"><a name="method-gtkoptionmenu--get-menu"></a><h3>gtk.OptionMenu.get_menu</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_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 menu widget or <code class="literal">None</code> if no
menu is associated</td></tr></tbody></table><p>The <code class="methodname">get_menu</code>() method returns the menu
that is associated with the optionmenu or <code class="literal">None</code> if no menu
is associated.</p></div><div class="refsect2" title="gtk.OptionMenu.set_menu"><a name="method-gtkoptionmenu--set-menu"></a><h3>gtk.OptionMenu.set_menu</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_menu</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>menu</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>menu</code></strong> :</span></p></td><td>a menu to be associated with the
optionmenu</td></tr></tbody></table><p>The <code class="methodname">set_menu</code>() method associates the
<a class="link" href="class-gtkmenu.html" title="gtk.Menu"><code class="classname">gtk.Menu</code></a> widget
specified by <em class="parameter"><code>menu</code></em> with the optionmenu thus providing
the way for a user to select a new choice. A simple menu, avoiding the use
of tearoff menu items, submenus, and accelerators, should be used.</p></div><div class="refsect2" title="gtk.OptionMenu.remove_menu"><a name="method-gtkoptionmenu--remove-menu"></a><h3>gtk.OptionMenu.remove_menu</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">remove_menu</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">remove_menu</code>() method removes the
currently associated menu from the optionmenu.</p></div><div class="refsect2" title="gtk.OptionMenu.get_history"><a name="method-gtkoptionmenu--get-history"></a><h3>gtk.OptionMenu.get_history</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_history</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 index of the selected menu item, or -1 if
there are no menu items</td></tr></tbody></table><p>The <code class="methodname">get_history</code>() method returns the
index of the currently selected menu item or -1 if there are no menu items.
The menu items are numbered from top to bottom, starting with 0.</p></div><div class="refsect2" title="gtk.OptionMenu.set_history"><a name="method-gtkoptionmenu--set-history"></a><h3>gtk.OptionMenu.set_history</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_history</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 display as the
selected optionmenu choice</td></tr></tbody></table><p>The <code class="methodname">set_history</code>() method selects the
menu item specified by <em class="parameter"><code>index</code></em> as the displayed
optionmenu choice.</p></div></div><div class="refsect1" title="Signals"><a name="id3916652"></a><h2>Signals</h2><div class="refsect2" title='The "changed" gtk.OptionMenu Signal'><a name="signal-gtkoptionmenu--changed"></a><h3>The "changed" gtk.OptionMenu Signal</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>optionmenu</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>optionmenu</code></em> :</span></p></td><td>the optionmenu that received the
signal</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><p>The "changed" signal is emitted when a new optionmenu choice is
made.</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-gtkobject.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-gtkpagesetup.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.Object </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.PageSetup</td></tr></table></div></body></html>