# importing only those functions
# which are needed
from tkinter import *
from tkinter.ttk import *
from time import strftime
# creating tkinter window
root = Tk()
root.title('App')
# Creating Menubar
menubar = Menu(root)
# Adding File Menu and commands
file = Menu(menubar, tearoff = 0)
menubar.add_cascade(label ='File', menu = print("File clicked"))
file.add_command(label ='New File', command = print("New clicked"))
file.add_command(label ='Open...', command = print("Open clicked"))
file.add_command(label ='Save', command = print("Save clicked"))
file.add_separator()
file.add_command(label ='Exit', command = root.destroy)
# Adding Help Menu
help_ = Menu(menubar, tearoff = 0)
menubar.add_cascade(label ='Help', menu = help_)
help_.add_command(label ='Tk Help', command = None)
help_.add_command(label ='Demo', command = None)
help_.add_separator()
help_.add_command(label ='About Tk', command = None)
# display Menu
root.config(menu = menubar)
mainloop()
from tkinter import *
m = Tk()
menu = Menu(m)
m.config(menu=menu)
filemenu = Menu(menu)
menu.add_cascade(label='File', menu=filemenu)
filemenu.add_command(label='New Text File')
filemenu.add_command(label='New File...')
filemenu.add_command(label='New Window')
filemenu.add_separator()
filemenu.add_command(label='Open File...')
filemenu.add_command(label='Open Folder...')
filemenu.add_command(label='Open Recent')
filemenu.add_separator()
filemenu.add_command(label='Save')
filemenu.add_command(label='Save As...')
filemenu.add_command(label='Save All')
filemenu.add_separator()
filemenu.add_command(label='Exit', command=m.quit)
helpmenu = Menu(menu)
menu.add_cascade(label='Help', menu=helpmenu)
helpmenu.add_command(label='About')
mainloop()
w = Menu(master, option=value)