Skip to content

Commit ef54a6d

Browse files
cydanilsebp
authored andcommitted
Describe ComboBox.set_active and use it in example
Closes #178
1 parent 5c2b677 commit ef54a6d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

examples/combobox_example.py

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def __init__(self):
6262
for currency in currencies:
6363
currency_combo.append_text(currency)
6464

65+
currency_combo.set_active(0)
6566
vbox.pack_start(currency_combo, False, False, 0)
6667

6768
self.add(vbox)

source/combobox.txt

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ If the combo box contains a large number of items, it may be better to display
1313
them in a grid rather than a list. This can be done by calling
1414
:meth:`Gtk.ComboBox.set_wrap_width`.
1515

16+
A default value can be set by calling :meth:`Gtk.ComboBox.set_active` with the index
17+
of the desired value.
18+
1619
The :class:`Gtk.ComboBox` widget usually
1720
restricts the user to the available choices, but it can optionally have an
1821
:class:`Gtk.Entry`, allowing the user to enter arbitrary text if none of the

0 commit comments

Comments
 (0)