I am working on this tutorial:

http://www.learningpython.com/2006/05/07/creating-a-gui-using-pygtk-and-glade/

As I progress throught the tutorial, I create a gui
with glade that contains a button that prints "Hello
World!" when I click it.  Here is the python code from
the tutorial:

#!/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 = "pyhelloworld.glade"  
                self.wTree = gtk.glade.XML(self.gladefile) 
                
                #Create our dictionay and connect it
                dic = { "on_btnHelloWorld_clicked" :
self.btnHelloWorld_clicked,
                        "on_MainWindow_destroy" : gtk.main_quit }
                self.wTree.signal_autoconnect(dic)

        def btnHelloWorld_clicked(self, widget):
                print "Hello World!"


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

The Hello World button works.  When I quit the gui by
pressing on the red button in the upper right, the gui
vanishes, but the process continues to run.

I tried to solve this problem by using glade to attach
the destroy_event to on_MainWindow_destroy and then
running the script again.  However, the fix did not
work!  

Has anyone else had similar problems with this tutorial!?
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to