开发者

Python Tkinter, simple example fails on win 7

开发者 https://www.devze.com 2023-01-08 12:57 出处:网络
From here I\'ve copied an example of python gui app, but it\'s not working. It starts up and show window, but when i click the Quit button it just freze. And if I run it ag开发者_如何转开发ain then i

From here I've copied an example of python gui app, but it's not working. It starts up and show window, but when i click the Quit button it just freze. And if I run it ag开发者_如何转开发ain then i got another quit button in previous window.

Is there error in example code or is this problem with win 7 ? I am using python 2.6.5 and win 7 32 bit.


When the button is clicked, it tries to call self.quit, which doesn't exist. Try adding this method to the Application class.

....
    def quit(self):
        import sys
        sys.exit()
....


def quit(self):
    self.master.destroy()

works too.

0

精彩评论

暂无评论...
验证码 换一张
取 消