I'm trying to do a menu using tkinter. But when I run the code, the window appears, but the menu doesn't. I'm getting no errors.
Here is my code:
from tkinter import *
root = Tk()
root.geometry("500x300")
menu = Menu(root)
file_menu = Menu(menu, tearoff=0)
file_menu.add_command(label="New")
file_menu.add_command(label="Open")
file_menu.add_command(label="Save")
menu.add_cascade(label="File", menu=file_menu)
menu
root.mainloop()
You haven't added it to the root window. You need to do the following after creating menu
:
root.configure(menu=menu)