equal
deleted
inserted
replaced
8 |
8 |
9 |
9 |
10 class MyApplication(Application): |
10 class MyApplication(Application): |
11 def __init__(self): |
11 def __init__(self): |
12 Application.__init__(self) |
12 Application.__init__(self) |
13 self.top.connect('keypress', self.on_keypress) |
13 self.top.connect('keypress', self.on_top_keypress) |
14 |
14 |
15 vert = VerticalLayout(homogeneous=False) |
15 vert = VerticalLayout(homogeneous=False) |
16 self.top.layout(vert) |
16 self.top.layout(vert) |
17 |
17 |
18 combo = ComboBox(items=['abc', 'xyz']) |
18 combo = ComboBox(items=['abc', 'xyz']) |
19 self.top.add(combo) |
19 self.top.add(combo) |
20 |
20 |
21 for i in range(10): |
21 for i in range(10): |
22 cbox = Checkbox('checkbox ' + str(i)) |
22 cbox = Checkbox('checkbox ' + str(i)) |
23 self.top.add(cbox) |
23 self.top.add(cbox) |
24 |
24 |
25 def on_keypress(self, keyname, char): |
25 def on_top_keypress(self, ev): |
26 if keyname == 'escape' or char == 'q': |
26 if ev.keyname == 'escape' or ev.char == 'q': |
27 self.terminate() |
27 self.terminate() |
28 |
28 |
29 |
29 |
30 if __name__ == '__main__': |
30 if __name__ == '__main__': |
31 app = MyApplication() |
31 app = MyApplication() |