You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
717 B
27 lines
717 B
3 years ago
|
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()
|