I have these few lines in a class in my program but it doesnt appear. No errors are shown and when i "print(menubar)" and address "0.4.." or "4..." appears

menubar = Menu(master = self.mainGUI)
fileMenu = Menu(menubar)
fileMenu.add_command(label="Exit", command= destroyMethod)
menubar.add_cascade(label="File", menu=fileMenu)

destroy method does work and is existing.

Maybe this will help ...

# a Tkinter menu example similar to:
# http://effbot.org/tkinterbook/tkinter-application-windows.htm

try:
    # Python2
    import Tkinter as tk
except ImportError:
    # Python3
    import tkinter as tk

def outer(val):
    """using a closure to pass args"""
    def inner():
        root.title(val)
    return inner

root = tk.Tk()

# create a menu
menu = tk.Menu(root)
root.config(menu=menu)

filemenu = tk.Menu(menu)
menu.add_cascade(label="File", menu=filemenu)
filemenu.add_command(label="New", command=outer("New"))
filemenu.add_command(label="Open", command=outer("Open"))
filemenu.add_separator()
filemenu.add_command(label="Exit", command=outer("Exit"))

helpmenu = tk.Menu(menu)
menu.add_cascade(label="Help", menu=helpmenu)
helpmenu.add_command(label="About", command=outer("About"))

root.mainloop()

I managed to fix it
this was the end code

menubar = Menu(self.mainGUI)
self.mainGUI.config(menu=menubar)
fileMenu = Menu(menubar)
fileMenu.add_command(label="Exit", command= self.destroyMethod)
menubar.add_cascade(label="File", menu=fileMenu)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.