Write documentation for sugar3.graphics.combobox

This commit is contained in:
Sam Parkinson
2015-11-15 07:00:39 +11:00
parent ec7f723819
commit a334888eb9
2 changed files with 61 additions and 21 deletions
+8 -15
View File
@@ -3,27 +3,20 @@ from gi.repository import Gtk
from sugar3.graphics.combobox import ComboBox
def _destroy_cb(widget, data=None):
Gtk.main_quit()
def __combo_changed_cb(widget, data=None):
print 'combo-changed'
def __combo_changed_cb(combo):
print 'Combo changed to %r' % combo.get_value()
w = Gtk.Window()
w.connect("destroy", _destroy_cb)
box = Gtk.VBox()
w.add(box)
w.connect("destroy", Gtk.main_quit)
combo = ComboBox()
combo.append_item(0, 'one')
combo.append_item(1, 'two', 'go-next')
combo.append_item(2, 'three')
combo.append_item(True, 'one')
combo.append_item(2, 'two', 'go-next')
combo.append_item('3', 'three')
# This will make 'two' active (zero indexed)
combo.set_active(1)
combo.connect('changed', __combo_changed_cb)
box.pack_start(combo, False, False, 0)
w.add(combo)
w.show_all()
Gtk.main()