[pygtk] gtk.builder.connect_signals just connects signals of one window

goli g382nilieh at gmail.com
Thu Mar 18 18:05:53 WST 2010


Hi all,
I have created a window and a dialog in a glade file, using GtkBuilder.
The Window has some buttons in it and the dialog has just one + default 
Ok-Cancel buttons.

In the code, I use below lines to connect all signals to the defined 
functions:

    self.builder = gtk.Builder()
    self.builder.add_from_file("../data/document.glade")
    self.window = self.builder.get_object("mywindow")
    ...
    self.window.show_all()
    self.builder.connect_signals(self)

And function below is called when one of the "mywindow" buttons is clicked:

    def myFunc(self, sender):
       dialog = self.builder.get_object("mydialog")
       ...
       result = dialog.run()
       ...
       dialog.hide()

That "mydialog" has a button which is connected to a simple function to 
print something:

    def testFunc(self, sender):
       print("testing connection...")

When I run the code, "mywindow" appears and all buttons are connected to 
their functions, but when "mydialog" opens, it seems that "testFunction" 
is not connected to the button.
Where is my fault? Can gtk.builder.connect_signals connect all signals 
in a glade file, before the corresponding widgets be shown on screen?
Thanks.


More information about the pygtk mailing list