Write documentation for sugar3.graphics.combobox
This commit is contained in:
+8
-15
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user