I'm trying to create a window that has a menu bar built into it, but whenever I implement a Tkinter code that creates a menu, it appears at the top next to the Apple logo. How can I make it so that it appears directly in the Tkinter window instead of the OSX menubar?
Here's the code I have so far:
import tkinter as tk
from tkinter.filedialog import askopenfilename
def NewFile():
print("New File!")
def OpenFile():
name = askopenfilename()
print(name)
def About():
print("This is a simple example of a menu")
root = tk.Tk()
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=NewFile)
filemenu.add_command(label="Open...", command=OpenFile)
filemenu.add_separator()
filemenu.add_command(label="Exit", command=root.quit)
helpmenu = tk.Menu(menu)
menu.add_cascade(label="Help", menu=helpmenu)
helpmenu.add_command(label="About...", command=About)
tk.mainloop()
Any and all help would be appreciated! Thanks.