[pygtk] "close window"not working

Festila Catalin catalinfest at gmail.com
Wed Jun 25 01:13:41 WST 2008


Hi !
I have this code :
#!/usr/bin/env python

import sys
try:
    import pygtk
    pygtk.require("2.0")
except:
      pass
try:
    import gtk
    import gtk.glade
except:
    sys.exit(1)
class HellowWorldGTK:
    """This is an Hello World GTK application"""

    def __init__(self):

        #Set the Glade file
        self.gladefile =3D "pygmail.glade"
        self.wTree =3D gtk.glade.XML(self.gladefile)

        #Get the Main Window, and connect the "destroy" event
        self.window =3D self.wTree.get_widget("Hello")
        if (self.window):
            self.window.connect("destroy", gtk.gtk_main_quit)

    def destroy(self, widget, data=3DNone):
        gtk.main_quit()

if __name__ =3D=3D "__main__":
    hwg =3D HellowWorldGTK()
    gtk.main()

The "Close window" ( X button right minimaze and maximaze ) if i preset the
windows close
but the python instance not stop . I must give Ctr +C to stop the script and
rezult is :
./pygmail.py
Traceback (most recent call last):
  File "./pygmail.py", line 33, in <module>
    gtk.main()
KeyboardInterrupt
Thank you !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20080624/0c2ca8f5/at=
tachment.htm


More information about the pygtk mailing list