def add_menus(self):
menubar = Menu(self.parent)
# create a pulldown menu, and add it to the menu bar
filemenu = Menu(menubar, tearoff=0)
filemenu.add_command(label="Open", command=self.hello)
filemenu.add_command(label="Save", command=self.hello)
filemenu.add_separator()
filemenu.add_command(label="Exit", command=self.parent.quit)
menubar.add_cascade(label="File", menu=filemenu)
# create more pulldown menus
editmenu = Menu(menubar, tearoff=0)
editmenu.add_command(label="Cut", command=self.hello)
editmenu.add_command(label="Copy", command=self.hello)
editmenu.add_command(label="Paste", command=self.hello)
menubar.add_cascade(label="Edit", menu=editmenu)
helpmenu = Menu(menubar, tearoff=0)
helpmenu.add_command(label="About", command=self.hello)
menubar.add_cascade(label="Help", menu=helpmenu)
# display the menu
self.parent.config(menu=menubar)
评论列表
文章目录