Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/examples/combobox.py
blob: a7128104e248dcfcd9f4ad77fca709c7ce377c3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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'

w = Gtk.Window()
w.connect("destroy", _destroy_cb)

box = Gtk.VBox()
w.add(box)

combo = ComboBox()
combo.append_item(0, 'one')
combo.append_item(1, 'two', 'go-next')
combo.append_item(2, 'three')
combo.set_active(1)
combo.connect('changed', __combo_changed_cb)
box.pack_start(combo, False, False, 0)

w.show_all()

Gtk.main()