forked from sirMackk/tkinter_examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
8_simple_menu.py
46 lines (30 loc) · 972 Bytes
/
8_simple_menu.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
from Tkinter import Tk, Frame, Menu
class Window(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.startUI()
def startUI(self):
self.parent.title("Simple menu")
menubar = Menu(self.parent)
self.parent.config(menu=menubar)
fileMenu = Menu(menubar)
fileMenu.add_command(label="Exit", command=self.onExit)
fileMenu.add_command(label="Bebs", command=self.bebs)
helpMenu = Menu(menubar)
helpMenu.add_command(label="help", command=self.help)
menubar.add_cascade(label="File", menu=fileMenu)
menubar.add_cascade(label="Help", menu=helpMenu)
def onExit(self):
self.quit()
def bebs(self):
print "bebs"
def help(self):
print "help"
def main():
root = Tk()
root.geometry("250x150+300+300")
app = Window(root)
root.mainloop()
if __name__ == '__main__':
main()