equal
deleted
inserted
replaced
|
1 #!/usr/bin/env python3 |
|
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 import locale |
|
5 import os |
|
6 |
|
7 from tuikit.application import Application |
|
8 from tuikit.editfield import EditField |
|
9 from tuikit.window import Window |
|
10 from tuikit.button import Button |
|
11 |
|
12 |
|
13 class MyApplication(Application): |
|
14 def __init__(self): |
|
15 Application.__init__(self) |
|
16 self.top.connect('keypress', self.globalkeypress) |
|
17 |
|
18 #edit = EditField(50, 'DlouhyTest12') |
|
19 #self.top.add(edit) |
|
20 |
|
21 win = Window() |
|
22 self.top.add(win) |
|
23 |
|
24 button = Button('click!') |
|
25 win.add(button) |
|
26 button.x = 10 |
|
27 button.y = 7 |
|
28 |
|
29 button.connect('click', self.buttonclick) |
|
30 self.button = button |
|
31 |
|
32 subwin = Window(8,8) |
|
33 win.add(subwin) |
|
34 |
|
35 |
|
36 def buttonclick(self): |
|
37 self.button.label = 'YES' |
|
38 |
|
39 |
|
40 def globalkeypress(self, keyname, char): |
|
41 if keyname == 'escape': |
|
42 self.terminate() |
|
43 |
|
44 |
|
45 if __name__ == '__main__': |
|
46 locale.setlocale(locale.LC_ALL, '') |
|
47 os.environ['ESCDELAY'] = '25' # do not wait 1 second after pressing Escape key |
|
48 app = MyApplication() |
|
49 app.start() |
|
50 |