-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