gtk.ComboBoxEntrya text entry field with
a dropdown list (new in PyGTK 2.4)Synopsisgtk.ComboBoxEntrygtk.ComboBoxgtk.CellLayoutgtk.ComboBoxEntrymodelNonecolumn-1set_text_columntext_columnget_text_columnFunctionsgtk.combo_box_entry_new_textAncestry+-- gobject.GObject
+-- gtk.Object
+-- gtk.Widget
+-- gtk.Container
+-- gtk.Bin
+-- gtk.ComboBox
+-- gtk.ComboBoxEntry
Implemented Interfacesgtk.ComboBoxEntry
implements
gtk.Buildablegtk.CellLayoutgtk.ComboBoxEntry Propertiesgtk.Object Propertiesgtk.Widget Propertiesgtk.Container Propertiesgtk.ComboBox Properties
"text-column"Read-WriteThe column in the gtk.TreeModel
to get the strings from.
gtk.ComboBoxEntry Style Propertiesgtk.Widget Style Propertiesgtk.ComboBox Style Propertiesgtk.ComboBoxEntry Signal Prototypesgobject.GObject Signal Prototypesgtk.Object Signal Prototypesgtk.Widget Signal Prototypesgtk.Container Signal Prototypesgtk.ComboBox Signal Prototypesgtk.CellEditable Signal PrototypesDescriptionThis widget is available in GTK+ 2.4 and PyGTK 2.4 and
above.The gtk.ComboBoxEntry
is a replacement for the gtk.Combo. The gtk.ComboBoxEntry
is subclassed from gtk.ComboBox and
implements the gtk.CellLayout
interface; refer to their descriptions for a number of useful methods and
properties for managing the contents of a combo box entry. A gtk.ComboBoxEntry
also contains a child gtk.Entry accessed by
using the child attribute of the combo box entry:
entry = comboboxentry.child
A gtk.ComboBoxEntry
is created with the gtk.ComboBoxEntry()
constructor. The constructor can also be called with the optional parameters
model (a gtk.TreeModel -
default None) and column (a number
of a column in model - default 0). If no gtk.TreeModel is
specified it can be added later with the set_model()
method. The text column can be changed using the set_text_column()
method. A new combo box entry is created and packed with a gtk.CellRendererText
but no attribute mappings are set on the cell renderer.Alternatively, the gtk.combo_box_entry_new_text()
function creates a gtk.ComboBoxEntry
with an associated gtk.ListStore
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 gtk.ComboBox.append_text(),
gtk.ComboBox.prepend_text(),
gtk.ComboBox.insert_text()
and gtk.ComboBox.remove_text()
can be used to manage the contents of the gtk.ComboBoxEntry. Using
the gtk.combo_box_entry_new_text()
function is equivalent to:
liststore = gtk.ListStore(gobject.TYPE_STRING)
comboboxentry = gtk.ComboBoxEntry(liststore, 0)
Constructorgtk.ComboBoxEntrymodelNonecolumn-1model :The gtk.TreeModel
to associate with the combo box entry, or
Nonecolumn :The number of the column to use for setting the
strings of the combo box entry.Returns :A new gtk.ComboBoxEntry.This constructor is available in PyGTK 2.4 and above.Creates a new gtk.ComboBoxEntry
that has a gtk.Entry as child
and associated with the gtk.TreeModel
specified by model and using the column of
model specified by column to
retrieve strings. If model was not specified it
defaults to None but you can change the model using the
gtk.ComboBox.set_model()
method. If column was not specified it defaults to -1
meaning the text column is unset but you can change it using the set_text_column()
method. Once the text column is set either in the constructor or using the
set_text_column()
method it cannot be changed. A ValueError exception is thrown if
column is outside the range of column numbers for
model.Methodsgtk.ComboBoxEntry.set_text_columnset_text_columntext_columntext_column :A column in the associated gtk.TreeModel
to use as the data source for the strings.This method is available in PyGTK 2.4 and above.The set_text_column() method sets the
"text-column" property to the value of tree_column
only if the text column has not been set (that is, "text-column" is -1). The
value of tree_column is the number of the tree model
column used as the data source for the strings of the combo box
entry.gtk.ComboBoxEntry.get_text_columnget_text_columnReturns :The number of the column in the associated
gtk.TreeModel
used as the data source for the combo box
entry.This method is available in PyGTK 2.4 and above.The get_text_column() method returns
the number of the gtk.TreeModel
column that is used as the data source for the strings of the combo box
entry.Functionsgtk.combo_box_entry_new_textgtk.combo_box_entry_new_textReturns :A new gtk.ComboBoxEntry
widget.This function is available in PyGTK 2.4 and above.The gtk.combo_box_entry_new_text() function
is a convenience function which constructs a new gtk.ComboBoxEntry,
just displaying strings. If you use this function to create a combo box
entry, you should only manipulate its gtk.TreeModel
data source with the following gtk.ComboBox
convenience methods: gtk.ComboBox.append_text(),
gtk.ComboBox.insert_text(),
gtk.ComboBox.prepend_text()
and gtk.ComboBox.remove_text().