gtk.Combo — a text entry field with a dropdown list.
class gtk.Combo(gtk.HBox): |
+--gobject.GObject +-- gtk.Object +-- gtk.Widget +-- gtk.Container +-- gtk.Box +-- gtk.HBox +-- gtk.Combo
|
The gtk.Combo
is
deprecated in GTK+ 2.4 and PyGTK 2.4 in favor of the gtk.ComboBox
.
The gtk.Combo
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
gtk.List
widget and can be accessed using the list
attribute of the gtk.Combo
. List
elements can contain arbitrary widgets, but if an element is not a plain
label, then you must use the
gtk.List.set_item_string
() method. This sets the
string which will be placed in the text entry field when the item is
selected.
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
set_use_arrows
()
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 set_use_arrows_always
()
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.
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.
def set_value_in_list(val
, ok_if_empty
)
| If True the value entered must match one of the values in the list. |
| If True an empty value is considered valid. |
The set_value_in_list
() 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 val
and the "allow-empty" property to
the value of ok_if_empty
.
If val
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 ok_if_empty
is True an empty
field is considered an acceptable value.
def set_use_arrows(val
)
| If True can be used to navigate through the list items |
The set_use_arrows
() method sets the
"enable-use-arrows" property to the value of val
. If
val
is True the arrows keys can be used to navigate
through the list items.
def set_use_arrows_always(val
)
| If True the arrow keys will still work even if the text entry field does not match any of the list items. |
The set_use_arrows_always
() method sets
the "enable-arrows-always" property to the values of
val
. If val
is True the arrow
keys will work even if the text entry field does not match any of the list
items.
def set_case_sensitive(val
)
| If True the text in the list items is case sensitive. |
The set_case_sensitive
() method sets
the "case-sensitive" property to the value of val
. If
val
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.
def set_item_string(item
, item_value
)
| a list item |
| a string to place in the entry field when
item is selected |
The set_item_string
() method sets the
string (from item_value
) to place in the combo text
entry field when the item
is selected. This method is
only needed if the list item is other than a simple label (e.g. a
pixmap).