author | Radek Brich <radek.brich@devl.cz> |
Mon, 17 Dec 2012 23:27:37 +0100 | |
changeset 39 | 5e5deb1d3945 |
parent 22 | 6ca8b2d221c3 |
child 41 | 37b7dfc3eae6 |
permissions | -rwxr-xr-x |
21 | 1 |
#!/usr/bin/env python3 |
2 |
# -*- coding: utf-8 -*- |
|
3 |
||
4 |
import locale |
|
5 |
locale.setlocale(locale.LC_ALL, '') |
|
6 |
||
7 |
from tuikit import Application |
|
8 |
from tuikit.layout import VerticalLayout |
|
9 |
from tuikit.tableview import TableView, TableModel |
|
10 |
||
11 |
||
12 |
class MyApplication(Application): |
|
13 |
def __init__(self): |
|
14 |
Application.__init__(self) |
|
15 |
self.top.connect('keypress', self.globalkeypress) |
|
16 |
||
17 |
data = [] |
|
18 |
for y in range(100): |
|
22
6ca8b2d221c3
Update TableView: cursor movement.
Radek Brich <radek.brich@devl.cz>
parents:
21
diff
changeset
|
19 |
row = [str(y+1)] |
21 | 20 |
for x in range(10): |
21 |
row.append('r{}:c{}'.format(y, x)) |
|
22 |
data.append(row) |
|
23 |
model = TableModel(data) |
|
24 |
||
25 |
view = TableView(model) |
|
26 |
view.addcolumn(header=True, expand=False, sizereq=5) |
|
27 |
for x in range(10): |
|
28 |
view.addcolumn(title='head'+str(x)) |
|
29 |
||
30 |
self.top.add(view, expand=True, fill=True) |
|
31 |
||
32 |
vert = VerticalLayout() |
|
33 |
self.top.layout(vert) |
|
34 |
||
35 |
def globalkeypress(self, keyname, char): |
|
36 |
if keyname == 'escape': |
|
37 |
self.terminate() |
|
38 |
||
39 |
||
40 |
if __name__ == '__main__': |
|
41 |
app = MyApplication() |
|
42 |
app.start() |
|
43 |