我是新来的Python GUI编程,通过本教程说明Tkinter的去使用类名没有定义,甚至说明后
我尝试下面的代码
import Tkinter
class simpleapp_tk(Tkinter.Tk):
def __init__(self,parent):
Tkinter.Tk.__init__(self,parent)
self.parent=parent
self.initialize()
def initialize(self):
pass
if __name__=="__main__":
app=simpleapp_tk(None)
app.title('my application')
app.mainloop()
我期望的空白窗口,而是得到这个
Traceback (most recent call last):
File "C:/Users/vedev/Desktop/python/app1.py", line 3, in <module>
class simpleapp_tk(Tkinter.Tk):
File "C:/Users/vedev/Desktop/python/app1.py", line 12, in simpleapp_tk
app=simpleapp_tk(None)
NameError: name 'simpleapp_tk' is not defined
我该如何调试?
是的,现在就去吧。 thanx寻求帮助@tynn –