我是新來的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 –