File: class-gtkcomboboxentry.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 (85 lines) | stat: -rw-r--r-- 17,906 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
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
75
76
77
78
79
80
81
82
83
84
85
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.ComboBoxEntry</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-gtkcombobox.html" title="gtk.ComboBox"><link rel="next" href="class-gtkcontainer.html" title="gtk.Container"></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.ComboBoxEntry</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkcombobox.html">Prev</a></td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gtkcontainer.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkcomboboxentry"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.ComboBoxEntry</h2><p>gtk.ComboBoxEntry &#8212; a text entry field with
    a dropdown list (new in PyGTK 2.4)</p></div><div class="refsect1" lang="en"><a name="id3394894"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.ComboBoxEntry</span></span>(<span class="ooclass"><span class="classname"><a href="class-gtkcombobox.html" title="gtk.ComboBox">gtk.ComboBox</a></span></span>, <span class="ooclass"><span class="classname"><a href="class-gtkcelllayout.html" title="gtk.CellLayout">gtk.CellLayout</a></span></span>):
<code class="constructorsynopsis">    <span class="methodname"><a href="class-gtkcomboboxentry.html#constructor-gtkcomboboxentry" title="Constructor">gtk.ComboBoxEntry</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>model</tt></b></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>column</tt></b></span><span class="initializer">=-1</span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkcomboboxentry.html#method-gtkcomboboxentry--set-text-column" title="gtk.ComboBoxEntry.set_text_column">set_text_column</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>text_column</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkcomboboxentry.html#method-gtkcomboboxentry--get-text-column" title="gtk.ComboBoxEntry.get_text_column">get_text_column</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
<span class="bold"><b>Functions</b></span>

<code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkcomboboxentry.html#function-gtk--combo-box-entry-new-text" title="gtk.combo_box_entry_new_text">gtk.combo_box_entry_new_text</a></span>(<span class="methodparam"></span>)</code></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3395005"></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-gtkcombobox.html" title="gtk.ComboBox">gtk.ComboBox</a>
            +-- <a href="class-gtkcomboboxentry.html" title="gtk.ComboBoxEntry">gtk.ComboBoxEntry</a> (implements <a href="class-gtkcelllayout.html" title="gtk.CellLayout"><tt class="classname">gtk.CellLayout</tt></a>)
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3395058"></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">"text-column"</td><td valign="top">Read-Write</td><td valign="top">The column in the <a href="class-gtktreemodel.html" title="gtk.TreeModel"><tt class="classname">gtk.TreeModel</tt></a>
	      to get the strings from.</td></tr></tbody></table></div></td></tr></table></div></div><div class="refsect1" lang="en"><a name="id3395124"></a><h2>Description</h2><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This widget is available in GTK+ 2.4 and PyGTK 2.4 and
      above.</p></div><p>The <a href="class-gtkcomboboxentry.html" title="gtk.ComboBoxEntry"><tt class="classname">gtk.ComboBoxEntry</tt></a>
is a replacement for the <a href="class-gtkcombo.html" title="gtk.Combo"><tt class="classname">gtk.Combo</tt></a>. The <a href="class-gtkcomboboxentry.html" title="gtk.ComboBoxEntry"><tt class="classname">gtk.ComboBoxEntry</tt></a>
is subclassed from <a href="class-gtkcombobox.html" title="gtk.ComboBox"><tt class="classname">gtk.ComboBox</tt></a> and
implements the <a href="class-gtkcelllayout.html" title="gtk.CellLayout"><tt class="classname">gtk.CellLayout</tt></a>
interface; refer to their descriptions for a number of useful methods and
properties for managing the contents of a combo box entry. A <a href="class-gtkcomboboxentry.html" title="gtk.ComboBoxEntry"><tt class="classname">gtk.ComboBoxEntry</tt></a>
also contains a child <a href="class-gtkentry.html" title="gtk.Entry"><tt class="classname">gtk.Entry</tt></a> accessed by
using the child attribute of the combo box entry:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  entry = comboboxentry.child
</pre></td></tr></table><p>A <a href="class-gtkcomboboxentry.html" title="gtk.ComboBoxEntry"><tt class="classname">gtk.ComboBoxEntry</tt></a>
is created with the <a href="class-gtkcomboboxentry.html#constructor-gtkcomboboxentry" title="Constructor">gtk.ComboBoxEntry()</a>
constructor. The constructor can also be called with the optional parameters
<i class="parameter"><tt>model</tt></i> (a <a href="class-gtktreemodel.html" title="gtk.TreeModel"><tt class="classname">gtk.TreeModel</tt></a> -
default <tt class="literal">None</tt>) and <i class="parameter"><tt>column</tt></i> (a number
of a column in <i class="parameter"><tt>model</tt></i> - default 0). If no <a href="class-gtktreemodel.html" title="gtk.TreeModel"><tt class="classname">gtk.TreeModel</tt></a> is
specified it can be added later with the <a href="class-gtkcombobox.html#method-gtkcombobox--set-model" title="gtk.ComboBox.set_model"><tt class="methodname">set_model</tt>()</a>
method. The text column can be changed using the <a href="class-gtkcomboboxentry.html#method-gtkcomboboxentry--set-text-column" title="gtk.ComboBoxEntry.set_text_column"><tt class="methodname">set_text_column</tt>()</a>
method. A new combo box entry is created and packed with a <a href="class-gtkcellrenderertext.html" title="gtk.CellRendererText"><tt class="classname">gtk.CellRendererText</tt></a>
but no attribute mappings are set on the cell renderer.</p><p>Alternatively, the <a href="class-gtkcomboboxentry.html#function-gtk--combo-box-entry-new-text" title="gtk.combo_box_entry_new_text"><tt class="function">gtk.combo_box_entry_new_text</tt>()</a>
function creates a <a href="class-gtkcomboboxentry.html" title="gtk.ComboBoxEntry"><tt class="classname">gtk.ComboBoxEntry</tt></a>
with an associated <a href="class-gtkliststore.html" title="gtk.ListStore"><tt class="classname">gtk.ListStore</tt></a>
model and the text column attribute mapping set to 0. In this combo box
entry each list item is a text string that can be selected.  The convenience
methods <a href="class-gtkcombobox.html#method-gtkcombobox--append-text" title="gtk.ComboBox.append_text"><tt class="methodname">gtk.ComboBox.append_text</tt>()</a>,
<a href="class-gtkcombobox.html#method-gtkcombobox--prepend-text" title="gtk.ComboBox.prepend_text"><tt class="methodname">gtk.ComboBox.prepend_text</tt>()</a>,
<a href="class-gtkcombobox.html#method-gtkcombobox--insert-text" title="gtk.ComboBox.insert_text"><tt class="methodname">gtk.ComboBox.insert_text</tt>()</a>
and <a href="class-gtkcombobox.html#method-gtkcombobox--remove-text" title="gtk.ComboBox.remove_text"><tt class="methodname">gtk.ComboBox.remove_text</tt>()</a>
can be used to manage the contents of the <a href="class-gtkcomboboxentry.html" title="gtk.ComboBoxEntry"><tt class="classname">gtk.ComboBoxEntry</tt></a>. Using
the <a href="class-gtkcomboboxentry.html#function-gtk--combo-box-entry-new-text" title="gtk.combo_box_entry_new_text"><tt class="function">gtk.combo_box_entry_new_text</tt>()</a>
function is equivalent to:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  liststore = gtk.ListStore(gobject.TYPE_STRING)
  comboboxentry = gtk.ComboBoxEntry(liststore, 0)
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="constructor-gtkcomboboxentry"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis">    <span class="methodname">gtk.ComboBoxEntry</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>model</tt></b></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>column</tt></b></span><span class="initializer">=-1</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>model</tt></b>:</span></td><td>The <a href="class-gtktreemodel.html" title="gtk.TreeModel"><tt class="classname">gtk.TreeModel</tt></a>
	to associate with the combo box entry, or
	<tt class="literal">None</tt></td></tr><tr><td><span class="term"><b class="parameter"><tt>column</tt></b>:</span></td><td>The number of the column to use for setting the
	strings of the combo box entry.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>A new <a href="class-gtkcomboboxentry.html" title="gtk.ComboBoxEntry"><tt class="classname">gtk.ComboBoxEntry</tt></a>.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This constructor is available in PyGTK 2.4 and above.</p></div><p>Creates a new <a href="class-gtkcomboboxentry.html" title="gtk.ComboBoxEntry"><tt class="classname">gtk.ComboBoxEntry</tt></a>
that has a <a href="class-gtkentry.html" title="gtk.Entry"><tt class="classname">gtk.Entry</tt></a> as child
and associated with the <a href="class-gtktreemodel.html" title="gtk.TreeModel"><tt class="classname">gtk.TreeModel</tt></a>
specified by <i class="parameter"><tt>model</tt></i> and using the column of
<i class="parameter"><tt>model</tt></i> specified by <i class="parameter"><tt>column</tt></i> to
retrieve strings. If <i class="parameter"><tt>model</tt></i> was not specified it
defaults to <tt class="literal">None</tt> but you can change the model using the
<a href="class-gtkcombobox.html#method-gtkcombobox--set-model" title="gtk.ComboBox.set_model"><tt class="methodname">gtk.ComboBox.set_model()</tt></a>
method. If <i class="parameter"><tt>column</tt></i> was not specified it defaults to -1
meaning the text column is unset but you can change it using the <a href="class-gtkcomboboxentry.html#method-gtkcomboboxentry--set-text-column" title="gtk.ComboBoxEntry.set_text_column"><tt class="methodname">set_text_column</tt>()</a>
method. Once the text column is set either in the constructor or using the
<a href="class-gtkcomboboxentry.html#method-gtkcomboboxentry--set-text-column" title="gtk.ComboBoxEntry.set_text_column"><tt class="methodname">set_text_column</tt>()</a>
method it cannot be changed. A ValueError exception is thrown if
<i class="parameter"><tt>column</tt></i> is outside the range of column numbers for
<i class="parameter"><tt>model</tt></i>.</p></div><div class="refsect1" lang="en"><a name="id3395513"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkcomboboxentry--set-text-column"></a><h3>gtk.ComboBoxEntry.set_text_column</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">set_text_column</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>text_column</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>text_column</tt></b>:</span></td><td>A column in the associated <a href="class-gtktreemodel.html" title="gtk.TreeModel"><tt class="classname">gtk.TreeModel</tt></a>
	  to use as the data source for the strings.</td></tr></tbody></table><div class="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 <tt class="methodname">set_text_column</tt>() method sets the
"text-column" property to the value of <i class="parameter"><tt>tree_column</tt></i>
only if the text column has not been set (that is, "text-column" is -1). The
value of <i class="parameter"><tt>tree_column</tt></i> is the number of the tree model
column used as the data source for the strings of the combo box
entry.</p></div><div class="refsect2" lang="en"><a name="method-gtkcomboboxentry--get-text-column"></a><h3>gtk.ComboBoxEntry.get_text_column</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_text_column</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 number of the column in the associated
	  <a href="class-gtktreemodel.html" title="gtk.TreeModel"><tt class="classname">gtk.TreeModel</tt></a>
	  used as the data source for the combo box
	  entry.</td></tr></tbody></table><div class="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 <tt class="methodname">get_text_column</tt>() method returns
the number of the <a href="class-gtktreemodel.html" title="gtk.TreeModel"><tt class="classname">gtk.TreeModel</tt></a>
column that is used as the data source for the strings of the combo box
entry.</p></div></div><div class="refsect1" lang="en"><a name="id3395659"></a><h2>Functions</h2><div class="refsect2" lang="en"><a name="function-gtk--combo-box-entry-new-text"></a><h3>gtk.combo_box_entry_new_text</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">gtk.combo_box_entry_new_text</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 <a href="class-gtkcomboboxentry.html" title="gtk.ComboBoxEntry"><tt class="classname">gtk.ComboBoxEntry</tt></a>
	  widget.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This function is available in PyGTK 2.4 and above.</p></div><p>The <tt class="function">gtk.combo_box_entry_new_text</tt>() function
is a convenience function which constructs a new <a href="class-gtkcomboboxentry.html" title="gtk.ComboBoxEntry"><tt class="classname">gtk.ComboBoxEntry</tt></a>,
just displaying strings. If you use this function to create a combo box
entry, you should only manipulate its <a href="class-gtktreemodel.html" title="gtk.TreeModel"><tt class="classname">gtk.TreeModel</tt></a>
data source with the following <a href="class-gtkcombobox.html" title="gtk.ComboBox"><tt class="classname">gtk.ComboBox</tt></a>
convenience methods: <a href="class-gtkcombobox.html#method-gtkcombobox--append-text" title="gtk.ComboBox.append_text"><tt class="methodname">gtk.ComboBox.append_text</tt>()</a>,
<a href="class-gtkcombobox.html#method-gtkcombobox--insert-text" title="gtk.ComboBox.insert_text"><tt class="methodname">gtk.ComboBox.insert_text</tt>()</a>,
<a href="class-gtkcombobox.html#method-gtkcombobox--prepend-text" title="gtk.ComboBox.prepend_text"><tt class="methodname">gtk.ComboBox.prepend_text</tt>()</a>
and <a href="class-gtkcombobox.html#method-gtkcombobox--remove-text" title="gtk.ComboBox.remove_text"><tt class="methodname">gtk.ComboBox.remove_text</tt>()</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-gtkcombobox.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-gtkcontainer.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.ComboBox</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.Container</td></tr></table></div></body></html>