-2
我是tkinter和所有人的新手,我正在學習一個教程,並且全面介紹函數的工作原理。我使用的是完全相同的代碼從教程但我仍然得到這個錯誤 - 「_tkinter.TclError:未知的選項‘-comnmand’」Python - tkinter - _tkinter.TclError:未知選項「-comnmand」
#!/usr/bin/env python
import tkinter as tk # Import the module
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.grid()
self.create_widgets()
def create_widgets(self):
self.quitButton = tk.Button(self, text='Quit', comnmand=self.quit)
self.quitButton.grid()
app = Application()
app.master.title('Sample App')
app.mainloop()
有誰知道一個解決方案或我做了什麼錯?我到處找......
'comnmand'?你確定這是正確的嗎? – iCodez 2014-12-06 21:57:01
comnmand應該是命令 – 2014-12-06 22:02:40
您應該相信錯誤消息,因爲它們至少90%是正確的。代碼運行良好,修正拼寫錯誤。 – 2014-12-06 23:36:50