-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenus.py
More file actions
27 lines (21 loc) · 718 Bytes
/
Menus.py
File metadata and controls
27 lines (21 loc) · 718 Bytes
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
from tkinter import *
class Window(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.master = master
menu = Menu(self.master)
self.master.config(menu=menu)
fileMenu = Menu(menu)
fileMenu.add_command(label="Item")
fileMenu.add_command(label="Exit", command=self.exitProgram)
menu.add_cascade(label="File", menu=fileMenu)
editMenu = Menu(menu)
editMenu.add_command(label="Undo")
editMenu.add_command(label="Redo")
menu.add_cascade(label="Edit", menu=editMenu)
def exitProgram(self):
exit()
root = Tk()
app = Window(root)
root.wm_title("Tkinter window")
root.mainloop()