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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.Combo</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-gtkcolorselectiondialog.html" title="gtk.ColorSelectionDialog"><link rel="next" href="class-gtkcombobox.html" title="gtk.ComboBox"></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.Combo</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkcolorselectiondialog.html">Prev</a></td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gtkcombobox.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkcombo"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.Combo</h2><p>gtk.Combo — a text entry field with a dropdown list.</p></div><div class="refsect1" lang="en"><a name="id3334511"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.Combo</span></span>(<span class="ooclass"><span class="classname"><a href="class-gtkhbox.html" title="gtk.HBox">gtk.HBox</a></span></span>):
<code class="constructorsynopsis"> <span class="methodname"><a href="class-gtkcombo.html#constructor-gtkcombo" title="Constructor">gtk.Combo</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcombo.html#method-gtkcombo--set-value-in-list" title="gtk.Combo.set_value_in_list">set_value_in_list</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>val</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>ok_if_empty</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcombo.html#method-gtkcombo--set-use-arrows" title="gtk.Combo.set_use_arrows">set_use_arrows</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>val</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcombo.html#method-gtkcombo--set-use-arrows-always" title="gtk.Combo.set_use_arrows_always">set_use_arrows_always</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>val</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcombo.html#method-gtkcombo--set-case-sensitive" title="gtk.Combo.set_case_sensitive">set_case_sensitive</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>val</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcombo.html#method-gtkcombo--set-item-string" title="gtk.Combo.set_item_string">set_item_string</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>item</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>item_value</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcombo.html#method-gtkcombo--set-popdown-strings" title="gtk.Combo.set_popdown_strings">set_popdown_strings</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>strings</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-gtkcombo.html#method-gtkcombo--disable-activate" title="gtk.Combo.disable_activate">disable_activate</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3328694"></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-gtkbox.html" title="gtk.Box">gtk.Box</a>
+-- <a href="class-gtkhbox.html" title="gtk.HBox">gtk.HBox</a>
+-- <a href="class-gtkcombo.html" title="gtk.Combo">gtk.Combo</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3328744"></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">"enable-arrow-keys"</td><td valign="top">Read/Write</td><td valign="top">If <tt class="literal">TRUE</tt>, the arrow keys move through the
list of items</td></tr><tr valign="top"><td valign="top">"enable-arrows-always"</td><td valign="top">Read/Write</td><td valign="top">If <tt class="literal">TRUE</tt>, the arrow keys work, even if
the entry contents are not in the list</td></tr><tr valign="top"><td valign="top">"case-sensitive"</td><td valign="top">Read/Write</td><td valign="top">If <tt class="literal">TRUE</tt>, list item matching is case
sensitive</td></tr><tr valign="top"><td valign="top">"allow-empty"</td><td valign="top">Read/Write</td><td valign="top">If <tt class="literal">TRUE</tt>, an empty value may be entered
in this field</td></tr><tr valign="top"><td valign="top">"value-in-list"</td><td valign="top">Read/Write</td><td valign="top">If <tt class="literal">TRUE</tt>, entered values must already be
present in the list</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3336345"></a><h2>Attributes</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">"entry"</td><td valign="top">Read</td><td valign="top">the text entry widget</td></tr><tr valign="top"><td valign="top">"list"</td><td valign="top">Read</td><td valign="top">the list shown in the drop-down window</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3336430"></a><h2>Description</h2><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The <a href="class-gtkcombo.html" title="gtk.Combo"><tt class="classname">gtk.Combo</tt></a> is
deprecated in GTK+ 2.4 and PyGTK 2.4 in favor of the <a href="class-gtkcombobox.html" title="gtk.ComboBox"><tt class="classname">gtk.ComboBox</tt></a>.</p></div><p>The <a href="class-gtkcombo.html" title="gtk.Combo"><tt class="classname">gtk.Combo</tt></a> widget
consists of a single-line text entry field and a drop-down list. The
drop-down list is displayed when the user clicks on a small arrow button to
the right of the entry field. The drop-down list is a
<tt class="classname">gtk.List</tt> widget and can be accessed using the list
attribute of the <a href="class-gtkcombo.html" title="gtk.Combo"><tt class="classname">gtk.Combo</tt></a>. List
elements can contain arbitrary widgets, but if an element is not a plain
label, then you must use the
<tt class="methodname">gtk.List.set_item_string</tt>() method. This sets the
string which will be placed in the text entry field when the item is
selected.</p><p>By default, the user can step through the items in the list using
the arrow (cursor) keys, though this behavior can be turned off with the
<a href="class-gtkcombo.html#method-gtkcombo--set-use-arrows" title="gtk.Combo.set_use_arrows"><tt class="methodname">set_use_arrows</tt>()</a>
method. Normally the arrow keys are only active when the contents of the
text entry field matches one of the items in the list. If the contents of
the entry field do not match any of the list items, then pressing the arrow
keys does nothing. However, by calling <a href="class-gtkcombo.html#method-gtkcombo--set-use-arrows" title="gtk.Combo.set_use_arrows"><tt class="methodname">set_use_arrows_always</tt>()</a>
you can specify that the arrow keys are always active. If the contents of
the entry field does not match any of the items in the list, then pressing
the up or down arrow key will set the entry field to the last or first item
in the list, respectively.</p><p>Note the list attribute references a gtk.List which is a
deprecated widget so the combo widget may be changed or deprecated in the
future.</p></div><div class="refsect1" lang="en"><a name="constructor-gtkcombo"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">gtk.Combo</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 combo object*</td></tr></tbody></table><p>Creates an new <a href="class-gtkcombo.html" title="gtk.Combo"><tt class="classname">gtk.Combo</tt></a>
object.</p></div><div class="refsect1" lang="en"><a name="id3333361"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkcombo--set-value-in-list"></a><h3>gtk.Combo.set_value_in_list</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_value_in_list</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>val</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>ok_if_empty</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>val</tt></b>:</span></td><td>If TRUE the value entered must match one of the
values in the list.</td></tr><tr><td><span class="term"><b class="parameter"><tt>ok_if_empty</tt></b>:</span></td><td>If TRUE an empty value is considered
valid.</td></tr></tbody></table><p>The <tt class="methodname">set_value_in_list</tt>() method
specifies whether the value entered in the text entry field must match one
of the values in the list. This method sets the "value-in-list" property to
the value of <i class="parameter"><tt>val</tt></i> and the "allow-empty" property to
the value of <i class="parameter"><tt>ok_if_empty</tt></i>.</p><p>If <i class="parameter"><tt>val</tt></i> is TRUE the user will not be able
to perform any other action (the widget grabs the focus) until a valid value
has been entered. If <i class="parameter"><tt>ok_if_empty</tt></i> is TRUE an empty
field is considered an acceptable value.</p></div><div class="refsect2" lang="en"><a name="method-gtkcombo--set-use-arrows"></a><h3>gtk.Combo.set_use_arrows</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_use_arrows</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>val</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>val</tt></b>:</span></td><td>If TRUE can be used to navigate through the
list items</td></tr></tbody></table><p>The <tt class="methodname">set_use_arrows</tt>() method sets the
"enable-use-arrows" property to the value of <i class="parameter"><tt>val</tt></i>. If
<i class="parameter"><tt>val</tt></i> is TRUE the arrows keys can be used to navigate
through the list items.</p></div><div class="refsect2" lang="en"><a name="method-gtkcombo--set-use-arrows-always"></a><h3>gtk.Combo.set_use_arrows_always</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_use_arrows_always</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>val</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>val</tt></b>:</span></td><td>If TRUE the arrow keys will still work even if
the text entry field does not match any of the list
items.</td></tr></tbody></table><p>The <tt class="methodname">set_use_arrows_always</tt>() method sets
the "enable-arrows-always" property to the values of
<i class="parameter"><tt>val</tt></i>. If <i class="parameter"><tt>val</tt></i> is TRUE the arrow
keys will work even if the text entry field does not match any of the list
items.</p></div><div class="refsect2" lang="en"><a name="method-gtkcombo--set-case-sensitive"></a><h3>gtk.Combo.set_case_sensitive</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_case_sensitive</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>val</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>val</tt></b>:</span></td><td>If TRUE the text in the list items is case
sensitive.</td></tr></tbody></table><p>The <tt class="methodname">set_case_sensitive</tt>() method sets
the "case-sensitive" property to the value of <i class="parameter"><tt>val</tt></i>. If
<i class="parameter"><tt>val</tt></i> is TRUE the text in the combo list items and the
text entry field are case sensitive. The default value of
"set-case-sensitive" is FALSE.</p></div><div class="refsect2" lang="en"><a name="method-gtkcombo--set-item-string"></a><h3>gtk.Combo.set_item_string</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_item_string</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>item</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>item_value</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>item</tt></b>:</span></td><td>a list item</td></tr><tr><td><span class="term"><b class="parameter"><tt>item_value</tt></b>:</span></td><td>a string to place in the entry field when
<i class="parameter"><tt>item</tt></i> is selected</td></tr></tbody></table><p>The <tt class="methodname">set_item_string</tt>() method sets the
string (from <i class="parameter"><tt>item_value</tt></i>) to place in the combo text
entry field when the <i class="parameter"><tt>item</tt></i> is selected. This method is
only needed if the list item is other than a simple label (e.g. a
pixmap).</p></div><div class="refsect2" lang="en"><a name="method-gtkcombo--set-popdown-strings"></a><h3>gtk.Combo.set_popdown_strings</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">set_popdown_strings</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>strings</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>strings</tt></b>:</span></td><td>a list of strings to populate the
list</td></tr></tbody></table><p>The <tt class="methodname">set_popdown_strings</tt>() method is a
convenience method that sets the strings used in the popdown list from.
<i class="parameter"><tt>strings</tt></i> (a Python list or tuple object).</p></div><div class="refsect2" lang="en"><a name="method-gtkcombo--disable-activate"></a><h3>gtk.Combo.disable_activate</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">disable_activate</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><p>The <tt class="methodname">disable_activate</tt>() method prevents
the combo from showing the popup list when the entry emits the "activate"
signal, i.e. when the <span><b class="keycap">Return</b></span> key is pressed. This may be
useful if, for example, you want the <span><b class="keycap">Return</b></span> key to close a
dialog instead. </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-gtkcolorselectiondialog.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-gtkcombobox.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.ColorSelectionDialog</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.ComboBox</td></tr></table></div></body></html>
|