File: class-gtkoptionmenu.html

package info (click to toggle)
python-gtk2-doc 2.5.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,304 kB
  • ctags: 3,741
  • sloc: makefile: 38
file content (39 lines) | stat: -rw-r--r-- 14,845 bytes parent folder | download
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
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.OptionMenu</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.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="previous" href="class-gtkobject.html" title="gtk.Object"><link rel="next" href="class-gtkpaned.html" title="gtk.Paned"></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-gtkpaned.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkoptionmenu"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.OptionMenu</h2><p>gtk.OptionMenu &#8212; a widget used to provide a list of valid choices.</p></div><div class="refsect1" lang="en"><a name="id3478673"></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 href="class-gtkbutton.html" title="gtk.Button">gtk.Button</a></span></span>):
<code class="constructorsynopsis">    <span class="methodname"><a 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 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 href="class-gtkoptionmenu.html#method-gtkoptionmenu--set-menu" title="gtk.OptionMenu.set_menu">set_menu</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>menu</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a 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 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 href="class-gtkoptionmenu.html#method-gtkoptionmenu--set-history" title="gtk.OptionMenu.set_history">set_history</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>index</tt></b></span></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3478805"></a><h2>Ancestry</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="synopsis">+-- <a href="class-gobject.html" title="gobject.GObject">gobject.GObject</a>
  +-- <a href="class-gtkobject.html" title="gtk.Object">gtk.Object</a>
    +-- <a href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a>
      +-- <a href="class-gtkcontainer.html" title="gtk.Container">gtk.Container</a>
        +-- <a href="class-gtkbin.html" title="gtk.Bin">gtk.Bin</a>
          +-- <a href="class-gtkbutton.html" title="gtk.Button">gtk.Button</a>
            +-- <a href="class-gtkoptionmenu.html" title="gtk.OptionMenu">gtk.OptionMenu</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3478860"></a><h2>Properties</h2><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col><col><col></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" lang="en"><a name="id3478929"></a><h2>Style Properties</h2><div class="blockquote"><table width="100%" border="0" bgcolor="#E0E0E0"><tr><td valign="top"><div class="informaltable"><table width="100%" border="0"><colgroup><col><col><col></colgroup><tbody><tr valign="top"><td valign="top">"indicator-spacing"</td><td valign="top">Read</td><td valign="top">The spacing around the indicator.</td></tr><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></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3479017"></a><h2>Signal Prototypes</h2><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term">"<a href="class-gtkoptionmenu.html#signal-gtkoptionmenu--changed" title='The "changed" gtk.OptionMenu Signal'>changed</a>"</span></td><td><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>optionmenu</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" lang="en"><a name="id3479074"></a><h2>Description</h2><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><a href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><tt class="classname">gtk.OptionMenu</tt></a>
is deprecated in PyGTK 2.4; use the <a href="class-gtkcombobox.html" title="gtk.ComboBox"><tt class="classname">gtk.ComboBox</tt></a>
instead.</p></div><p>A <a href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><tt class="classname">gtk.OptionMenu</tt></a>
is a widget allows the user to choose from a list of valid choices from an
associated menu. The <a href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><tt class="classname">gtk.OptionMenu</tt></a>
displays the last selected choice. When activated (clicked) the <a href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><tt class="classname">gtk.OptionMenu</tt></a>
displays a popup <a href="class-gtkmenu.html" title="gtk.Menu"><tt class="classname">gtk.Menu</tt></a> which allows
the user to make a new choice. Using a <a href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><tt class="classname">gtk.OptionMenu</tt></a>
is simple:</p><div class="itemizedlist"><ul type="disc"><li>build a <a href="class-gtkmenu.html" title="gtk.Menu"><tt class="classname">gtk.Menu</tt></a> using <a href="class-gtkmenu.html#constructor-gtkmenu" title="Constructor"><tt class="methodname">gtk.Menu</tt>()</a></li><li>then append menu items to it using <a href="class-gtkmenushell.html#method-gtkmenushell--append" title="gtk.MenuShell.append"><tt class="methodname">gtk.MenuShell.append</tt>()</a></li><li>associate the menu with the option menu using <a href="class-gtkoptionmenu.html#method-gtkoptionmenu--set-menu" title="gtk.OptionMenu.set_menu"><tt class="methodname">set_menu</tt>()</a></li><li>set the selected menu item with <a href="class-gtkoptionmenu.html#method-gtkoptionmenu--set-history" title="gtk.OptionMenu.set_history"><tt class="methodname">set_history</tt>()</a></li><li>connect to the "changed" signal on the option menu; in the
"changed" signal</li><li>check the new selected menu item with <a href="class-gtkoptionmenu.html#method-gtkoptionmenu--get-history" title="gtk.OptionMenu.get_history"><tt class="methodname">get_history</tt>()</a>.</li></ul></div></div><div class="refsect1" lang="en"><a name="constructor-gtkoptionmenu"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis">    <span class="methodname">gtk.OptionMenu</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new optionmenu widget</td></tr></tbody></table><p>Creates a new <a href="class-gtkoptionmenu.html" title="gtk.OptionMenu"><tt class="classname">gtk.OptionMenu</tt></a>
widget.</p></div><div class="refsect1" lang="en"><a name="id3479299"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkoptionmenu--get-menu"></a><h3>gtk.OptionMenu.get_menu</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_menu</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a menu widget or <tt class="literal">None</tt> if no
menu is associated</td></tr></tbody></table><p>The <tt class="methodname">get_menu</tt>() method returns the menu
that is associated with the optionmenu or <tt class="literal">None</tt> if no menu
is associated.</p></div><div class="refsect2" lang="en"><a name="method-gtkoptionmenu--set-menu"></a><h3>gtk.OptionMenu.set_menu</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_menu</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>menu</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>menu</tt></b>:</span></td><td>a menu to be associated with the
optionmenu</td></tr></tbody></table><p>The <tt class="methodname">set_menu</tt>() method associates the
<a href="class-gtkmenu.html" title="gtk.Menu"><tt class="classname">gtk.Menu</tt></a> widget
specified by <i class="parameter"><tt>menu</tt></i> 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" lang="en"><a name="method-gtkoptionmenu--remove-menu"></a><h3>gtk.OptionMenu.remove_menu</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">remove_menu</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><p>The <tt class="methodname">remove_menu</tt>() method removes the
currently associated menu from the optionmenu.</p></div><div class="refsect2" lang="en"><a name="method-gtkoptionmenu--get-history"></a><h3>gtk.OptionMenu.get_history</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_history</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the index of the selected menu item, or -1 if
there are no menu items</td></tr></tbody></table><p>The <tt class="methodname">get_history</tt>() 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" lang="en"><a name="method-gtkoptionmenu--set-history"></a><h3>gtk.OptionMenu.set_history</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_history</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>index</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>index</tt></b>:</span></td><td>the index of the menu item to display as the
selected optionmenu choice</td></tr></tbody></table><p>The <tt class="methodname">set_history</tt>() method selects the
menu item specified by <i class="parameter"><tt>index</tt></i> as the displayed
optionmenu choice.</p></div></div><div class="refsect1" lang="en"><a name="id3479595"></a><h2>Signals</h2><div class="refsect2" lang="en"><a name="signal-gtkoptionmenu--changed"></a><h3>The "changed" gtk.OptionMenu Signal</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>optionmenu</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><i class="parameter"><tt>optionmenu</tt></i>:</span></td><td>the optionmenu that received the
signal</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_param1</tt></i>:</span></td><td>the first user parameter (if any) specified
with the <a href="class-gobject.html#method-gobject--connect" title="gobject.GObject.connect"><tt class="methodname">connect</tt>()</a>
method</td></tr><tr><td><span class="term"><i class="parameter"><tt>...</tt></i>:</span></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-gtkpaned.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.Paned</td></tr></table></div></body></html>