[Tutor] GUI die when execute sys.exit()

Peter He qhe@ydyn.com
Wed, 27 Jun 2001 09:07:02 -0500


Hi, there,

Here is a small example from Mark Lutz's book -- Programming Python 2nd 
Edition.

from Tkinter import *

class HelloClass:
     def __init__(self):
         widget = Button(None, text='Hello event world', command=self.quit)
         widget.pack()
     def quit(self):
         print 'Hello class method world'    # self.quit is a bound method
         import sys; sys.exit()              # retains the self+quit pair

HelloClass()
mainloop()


When I run it and click the button, the gui die and I got the following 
message:

 >>> Unhandled exception while debugging...
Traceback (most recent call last):
   File "C:\PP2ndEd\Examples\PP2E\Gui\Intro\gui3c.py", line 9, in quit
     import sys; sys.exit()              # retains the self+quit pair
SystemExit

I am using Pythonwin IDE from ActiveStates and windows 2000. I got the same 
problems when I run other similar examples from other books too.

Thank you in advance!

Peter