[pygtk] Problem with PyGtk (Builder)

Nathan Samson nathansamson at gmail.com
Thu Jun 26 01:04:49 WST 2008


Hi,

I don't know if this is normal behaviour or a bug in (Py)Gtk, so I post it
first here.

This is a simple test app


#Start of application

import gtk

class class1():

    def __init__(self):
        print "INIT"

        builder =3D gtk.Builder()
        builder.add_from_file("gtk-builder-test.ui")
        builder.get_object("window1").show()

        builder.connect_signals(self)

        c2 =3D class2()
        builder.connect_signals(c2)

        gtk.main()
        print "QUITTED"

    def onDeleteEvent(self, wnd, test):
        print "CLASS 1"
        gtk.main_quit()


class class2():
    def __init__(self):
        print "INIT2"

    def onDeleteEvent(self, wnd, test):
        print "CLASS 2"

c =3D class1()

# End of application

# Start of gtk-builder-test.ui

<?xml version=3D"1.0"?>
<!--Generated with glade3 3.4.5 on Wed Jun 25 18:34:34 2008 -->
<interface>
  <object class=3D"GtkWindow" id=3D"window1">
    <signal handler=3D"onDeleteEvent" name=3D"delete_event"/>
    <child>
      <placeholder/>
    </child>
  </object>
</interface>

# End of gtkbuilder file



Expected behaviour (and output on console)
INIT
INIT2
# Now I click on the windows' close button
CLASS 1
CLASS 2
QUITTED

But for some reason class2.onDeleteEvent is not called


It seems that calling builder.connect_signals(object) doesn't have any
effect.



Greetings,
Nathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20080625/f2bb0360/at=
tachment.htm


More information about the pygtk mailing list