equal
deleted
inserted
replaced
|
1 #!/usr/bin/env python3 |
|
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 import locale |
|
5 locale.setlocale(locale.LC_ALL, '') |
|
6 |
|
7 from tuikit import * |
|
8 |
|
9 |
|
10 class MyApplication(Application): |
|
11 def __init__(self): |
|
12 Application.__init__(self) |
|
13 self.top.connect('keypress', self.globalkeypress) |
|
14 |
|
15 menubar = MenuBar() |
|
16 self.top.add(menubar) |
|
17 |
|
18 helpwin = Window() |
|
19 self.top.add(helpwin) |
|
20 helpwin.x = 10 |
|
21 helpwin.y = 5 |
|
22 helpwin.allowlayout = False |
|
23 helpwin.hidden = True |
|
24 helpwin.title = 'About' |
|
25 #helpwin.closebutton = False |
|
26 #helpwin.resizable = False |
|
27 |
|
28 |
|
29 filemenu = Menu([ |
|
30 ('New', None), |
|
31 None, |
|
32 ('Open', None), |
|
33 ('Save', None), |
|
34 None, |
|
35 ('Quit', self.terminate), |
|
36 ]) |
|
37 self.top.add(filemenu) |
|
38 |
|
39 editmenu = Menu([('Copy', None), ('Paste', None)]) |
|
40 helpmenu = Menu([('About', helpwin)]) |
|
41 |
|
42 self.top.add(editmenu) |
|
43 self.top.add(helpmenu) |
|
44 |
|
45 menubar.setitems([ |
|
46 ('File', filemenu), |
|
47 ('Edit', editmenu), |
|
48 ('Help', helpmenu), |
|
49 ]) |
|
50 |
|
51 vert = VerticalLayout() |
|
52 self.top.layout(vert) |
|
53 |
|
54 |
|
55 #button = Button('click!') |
|
56 #win.add(button) |
|
57 #button.x = 10 |
|
58 #button.y = 7 |
|
59 |
|
60 #button.connect('click', self.buttonclick) |
|
61 #self.button = button |
|
62 |
|
63 #subwin = Window(8,8) |
|
64 #win.add(subwin) |
|
65 |
|
66 |
|
67 def globalkeypress(self, keyname, char): |
|
68 if keyname == 'escape': |
|
69 self.terminate() |
|
70 |
|
71 |
|
72 if __name__ == '__main__': |
|
73 app = MyApplication() |
|
74 app.start() |
|
75 |