2006年02月26日 星期日 12:07
这个程序执行不了,在mainloop()那一行会出错,把类Gui里面的内容放到外面就可以。
但我看python核心编程里就有同样的写法,难道是因为原来的版本太旧了?
刚开始用Tkinter,还请指点一下。
from Tkinter import *
class Gui:
def __init__(self):
self.root = Tk()
self.a = Button(self.root, text='aaa', command=self.click)
self.a.pack()
def click(self):
print 'aaa'
self.root.quit()
def main():
x = Gui
mainloop()
if __name__ == '__main__':
main()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060226/4eaf6d91/attachment.html
2006年02月26日 星期日 13:34
def main():
x = Gui()
mainloop()
在06-2-26,Gu Yingbo <tensiongyb at gmail.com> 写道:
>
> 这个程序执行不了,在mainloop()那一行会出错,把类Gui里面的内容放到外面就可以。
> 但我看python核心编程里就有同样的写法,难道是因为原来的版本太旧了?
> 刚开始用Tkinter,还请指点一下。
>
> from Tkinter import *
> class Gui:
> def __init__(self):
> self.root = Tk()
> self.a = Button(self.root, text='aaa', command=self.click)
> self.a.pack()
> def click(self):
> print 'aaa'
> self.root.quit()
>
> def main():
> x = Gui
> mainloop()
>
> if __name__ == '__main__':
> main()
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060226/4e30f5c9/attachment.htm
2006年02月26日 星期日 14:28
哦,低级错误啊! On 2/26/06, helium <helium.sun at gmail.com> wrote: > > def main(): > x = Gui() > mainloop() > > 在06-2-26,Gu Yingbo <tensiongyb at gmail.com> 写道: > > > > 这个程序执行不了,在mainloop()那一行会出错,把类Gui里面的内容放到外面就可以。 > > 但我看python核心编程里就有同样的写法,难道是因为原来的版本太旧了? > > 刚开始用Tkinter,还请指点一下。 > > > > from Tkinter import * > > class Gui: > > def __init__(self): > > self.root = Tk() > > self.a = Button(self.root, text='aaa', command=self.click) > > self.a.pack() > > def click(self): > > print 'aaa' > > self.root.quit() > > > > def main(): > > x = Gui > > mainloop() > > > > if __name__ == '__main__': > > main() > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060226/6ed5ed6d/attachment.html
Zeuux © 2025
京ICP备05028076号