Do it with GtkBuilder:
builder = gtk.Builder() builder.add_from_file("GUI.xml") builder.connect_signals(self) self.window1 = builder.get_object("window1") self.window1.show()
change
I was initially mistaken, it seems that gtkbuilder makes an instance of objects when it adds. Thus, the ideal way to do this would be to add the widget manually using the line
builder.add_from_string(""" <interface> <object class="GtkWindow" id="window1"> <child> <object class="GtkComboBox" id="combobox1"> <property name="model">liststore1</property> </object> </child> </object> </interface>""") self.window1 = builder.get_object("window1")
Hope it works!
source share