10 |
10 |
11 |
11 |
12 class MyApplication(Application): |
12 class MyApplication(Application): |
13 def __init__(self): |
13 def __init__(self): |
14 Application.__init__(self) |
14 Application.__init__(self) |
15 self.top.connect('keypress', self.globalkeypress) |
15 self.top.connect('keypress', self.on_top_keypress) |
16 |
16 |
17 data = [] |
17 data = [] |
18 for y in range(100): |
18 for y in range(100): |
19 row = [str(y+1)] |
19 row = [str(y+1)] |
20 for x in range(10): |
20 for x in range(10): |
21 row.append('r{}:c{}'.format(y, x)) |
21 row.append('r{}:c{}'.format(y, x)) |
22 data.append(row) |
22 data.append(row) |
23 model = TableModel(data) |
23 model = TableModel(data) |
24 |
24 |
25 view = TableView(model) |
25 view = TableView(model) |
26 view.addcolumn(header=True, expand=False, sizereq=5) |
26 view.addcolumn(header=True, expand=False, sizereq=5) |
27 for x in range(10): |
27 for x in range(10): |
28 view.addcolumn(title='head'+str(x)) |
28 view.addcolumn(title='head'+str(x)) |
29 |
29 |
30 self.top.add(view, expand=True, fill=True) |
30 self.top.add(view, expand=True, fill=True) |
31 |
31 |
32 vert = VerticalLayout() |
32 vert = VerticalLayout() |
33 self.top.layout(vert) |
33 self.top.layout(vert) |
34 |
34 |
35 def globalkeypress(self, keyname, char): |
35 def on_top_keypress(self, ev): |
36 if keyname == 'escape': |
36 if ev.keyname == 'escape': |
37 self.terminate() |
37 self.terminate() |
38 |
38 |
39 |
39 |
40 if __name__ == '__main__': |
40 if __name__ == '__main__': |
41 app = MyApplication() |
41 app = MyApplication() |