未绑定方法 mainloop() 必须以 Tk 实例作为第一个参数调用(取而代之的是什么)
unbound method mainloop() must be called with Tk instance as first argument (got nothing instead)
下面的代码是一个简单的代码,我试图检查 Tkinter 是否工作...
import Tkinter
top=Tkinter.Tk
top.mainloop()
根据https://www.tutorialspoint.com/python/python_gui_programming.html
这应该会打开一个空白window
但是收到如下错误信息
File "b.py", line 3, in <module>
top.mainloop()
TypeError: unbound method mainloop() must be called with Tk instance as first argument (got nothing instead)
任何建议...
Tkinter.Tk() 创建一个 Tk() 对象的实例,作为主循环的参数。改为这样做:
top = Tkinter.tk() //will open a pop up box
top.mainloop()
阅读此内容以进一步了解。
下面的代码是一个简单的代码,我试图检查 Tkinter 是否工作...
import Tkinter
top=Tkinter.Tk
top.mainloop()
根据https://www.tutorialspoint.com/python/python_gui_programming.html
这应该会打开一个空白window
但是收到如下错误信息
File "b.py", line 3, in <module>
top.mainloop()
TypeError: unbound method mainloop() must be called with Tk instance as first argument (got nothing instead)
任何建议...
Tkinter.Tk() 创建一个 Tk() 对象的实例,作为主循环的参数。改为这样做:
top = Tkinter.tk() //will open a pop up box
top.mainloop()
阅读此内容以进一步了解。