Gtk.builder() And Multiple Glade Files Breaks
I have a glade gui, and I want to insert another object using a glade file as well. When I do it as bellow (this is essentially what I am doing) the whole app hangs and the self.
Solution 1:
Is there a good reason for using the same gtk.Builder
object in two classes?
This might be the cause of your problem. In your one
class, you load a glade file but you never do anything with its widgets. Something like this should work:
classone(gtk.VBox):
def__init__(self):
gtk.VBox.__init__(self)
self.builder = gtk.Builder()
self.builder.add_from_file("ui_for_one.glade")
some_widget = self.builder.get_object("some_widget")
self.add(some_widget)
self.builder.connect_signals(self)
# No reason to call self.show() here, that should be done manually.#Your callback functions hereclasstwo(object): # This is the page in a notebook. def__init__(self):
self.builder = gtk.Builder()
self.builder.add_from_file("ui_for_two.glade")
self.some_container = self.builder.get_object("some_container")
self.one = one()
self.some_container.pack_start(self.one, False, False)
self.some_container.show_all() #recursively show some_container and all its child widgets
self.builder.connect_signals(self)
For more info, check out these Glade tutorials.
Post a Comment for "Gtk.builder() And Multiple Glade Files Breaks"