I am programming a menu into my first python tkinter menu window. I have done it all right (I think) but the menu doesn't appear on my tkinter window.
My code is:
from tkinter import *
def f1():
label = Label(window, text="Wassup CHUNGUS!!!")
label.grid(row=0, column=0, sticky=W)
global window
window = Tk()
window.title("CHUNGUS")
label2 = Label(window, text="!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
label2.grid(row=2, column=0, sticky=W)
menubar = Menu(window)
firstmenu = Menu(menubar, tearoff=0)
firstmenu.add_command(label="EXIT", command=window.destroy)
firstmenu.add_command(label="CHUNGUS", command =f1)
menubar.add_cascade(label="Menu", menu=firstmenu)
window.mainloop()
Can I have some help?
This is quite easy. You have not included
window.config(menu=menubar)
. You should put it before thewindow.mainloop()
so: