2011-10-31 19:56:13 +01:00
|
|
|
from gi.repository import Gtk
|
|
|
|
|
|
|
|
from sugar3.graphics.combobox import ComboBox
|
|
|
|
|
2013-05-18 04:48:47 +02:00
|
|
|
|
2015-11-14 21:00:39 +01:00
|
|
|
def __combo_changed_cb(combo):
|
|
|
|
print 'Combo changed to %r' % combo.get_value()
|
2011-10-31 19:56:13 +01:00
|
|
|
|
|
|
|
w = Gtk.Window()
|
2015-11-14 21:00:39 +01:00
|
|
|
w.connect("destroy", Gtk.main_quit)
|
2011-10-31 19:56:13 +01:00
|
|
|
|
|
|
|
combo = ComboBox()
|
2015-11-14 21:00:39 +01:00
|
|
|
combo.append_item(True, 'one')
|
|
|
|
combo.append_item(2, 'two', 'go-next')
|
|
|
|
combo.append_item('3', 'three')
|
|
|
|
# This will make 'two' active (zero indexed)
|
2011-10-31 19:56:13 +01:00
|
|
|
combo.set_active(1)
|
|
|
|
combo.connect('changed', __combo_changed_cb)
|
2015-11-14 21:00:39 +01:00
|
|
|
w.add(combo)
|
2011-10-31 19:56:13 +01:00
|
|
|
|
|
|
|
w.show_all()
|
|
|
|
Gtk.main()
|