0
我不斷收到錯誤:Tkinter的未知選項 - 菜單
_tkinter.TclError: unknown option "-menu"
我MWE的樣子:
from tkinter import *
def hello():
print("hello!")
class Application(Frame):
def createWidgets(self):
self.menuBar = Menu(master=self)
self.filemenu = Menu(self.menuBar, tearoff=0)
self.filemenu.add_command(label="Hello!", command=hello)
self.filemenu.add_command(label="Quit!", command=self.quit)
def __init__(self, master):
Frame.__init__(self, master)
self.pack()
self.createWidgets()
self.config(menu=self.menuBar)
if __name__ == "__main__":
root = Tk()
ui = Application(root)
ui.mainloop()
我OS X 10.8使用python 3.爲什麼我收到未知選項錯誤?