-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbig_gui.py
87 lines (76 loc) · 2.82 KB
/
big_gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import sys, os
from tkinter import *
from guimixin import *
from guimaker import *
class Hello(GuiMixin, GuiMakerWindowMenu):
def start(self):
self.hellos = 0
self.master.title("GuiMaker Demo")
self.master.iconname("GuiMaker")
def spawnme(): self.spawn('D:\\Projects\\Train\\big_gui.py')
self.menuBar = [
('File', 0,
[('New...', 0, spawnme),
('Open...', 0, self.fileOpen),
('Quit', 0, self.quit)]
),
('Edit', 0,
[('Cut', -1, self.notdone),
('Paste', -1, self.notdone),
'separator',
('Stuff', -1,
[('Clone', -1, self.clone),
('More', -1, self.more)]
),
('Delete', -1, lambda: 0),
[5]]
),
('Play', 0,
[('Hello', 0, self.greeting),
('Popup...', 0, self.dialog),
('Demos', 0,
[('Toplevels', 0,
lambda: self.spawn(r'D:\Projects\Train\\toplevel2.py')),
('Frames', 0,
lambda: self.spawn(r'D:\Projects\Train\\demoAll-frm-ridge.py')),
('Images', 0,
lambda: self.spawn(r'D:\Projects\Train\\buttonpics.py')),
('Alarm', 0,
lambda: self.spawn(r'D:\Projects\Train\\alarm.py', wait=False)),
('Other...', -1, self.pickDemo)]
)]
)]
self.toolBar = [
('Quit', self.quit, dict(side=RIGHT)),
('Hello', self.greeting, dict(side=LEFT)),
('Popup', self.dialog, dict(side=LEFT, expand=YES)) ]
def makeWidgets(self):
middle = Label(self, text='Hello maker world!',
width=40, height=10,
relief=SUNKEN, cursor='pencil', bg='white')
middle.pack(expand=YES, fill=BOTH)
def greeting(self):
self.hellos += 1
if self.hellos % 3:
print('hi')
else:
self.infobox('Three', 'HELLO!')
def dialog(self):
button = self.question('OOPS!',
'You typed "rm*" ... continue?',
'questhead', ('yes', 'no'))
[lambda: None, self.quit][button]()
def fileOpen(self):
pick = self.selectOpenFile(file='D:\\Projects\\Train\\big_gui.py')
if pick:
self.browser(pick)
def more(self):
new = Toplevel()
Label(new, text='A new non-modal window').pack()
Button(new, text='Quit', command=self.quit).pack(side=LEFT)
Button(new, text='More', command=self.more).pack(side=RIGHT)
def pickDemo(self):
pick = self.selectOpenFile(dir='..')
if pick:
self.spawn(pick)
if __name__ == '__main__': Hello().mainloop()