author | Radek Brich <radek.brich@devl.cz> |
Fri, 14 Dec 2012 10:20:14 +0100 | |
changeset 32 | 088b92ffb119 |
parent 30 | 05500124d7fb |
child 34 | e3beacd5e536 |
permissions | -rwxr-xr-x |
30
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
1 |
#!/usr/bin/env python3 |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
2 |
# -*- coding: utf-8 -*- |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
3 |
|
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
4 |
import locale |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
5 |
locale.setlocale(locale.LC_ALL, '') |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
6 |
|
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
7 |
from tuikit import * |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
8 |
|
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
9 |
|
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
10 |
class MyApplication(Application): |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
11 |
def __init__(self): |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
12 |
Application.__init__(self) |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
13 |
self.top.connect('keypress', self.globalkeypress) |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
14 |
|
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
15 |
vert = VerticalLayout(homogeneous=False) |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
16 |
self.top.layout(vert) |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
17 |
|
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
18 |
combo = ComboBox(items=['abc', 'xyz']) |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
19 |
self.top.add(combo) |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
20 |
|
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
21 |
for i in range(10): |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
22 |
cbox = Checkbox('checkbox ' + str(i)) |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
23 |
self.top.add(cbox) |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
24 |
|
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
25 |
def globalkeypress(self, keyname, char): |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
26 |
if keyname == 'escape' or char == 'q': |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
27 |
self.terminate() |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
28 |
|
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
29 |
|
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
30 |
if __name__ == '__main__': |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
31 |
app = MyApplication() |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
32 |
app.start() |
05500124d7fb
Add setup script. Add Checkbox widget + demo. Updates.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
33 |