[Glade-users] Problem with GtkBuilder
Manuel Alejandro Cerón Estrada
ceronman at gmail.com
Wed Oct 7 12:42:08 EDT 2009
2009/10/7 Aidin Gharibnavaz <aidin at aidinhut.com>:
> Hi!
>
> I have a problem with glade, and GtkBuilder. I create a UI with glade, and
> load
> it in my python application, using following codes:
>
> builder = gtk.Builder();
> builder.add_from_file("sample.glade")
>
> It works nicely. But I can't add something to my containers using
> 'pack_start()',
> 'add_child()', or anything else. I do as following:
>
> builder.get_object('vbox1').add_child(mywidget)
>
> It don't throw any error, but also don't add 'mywidget' into the box.
> Is it possible to do something like this?
Yes, it is possible. With boxes the methods pack_start and pack_end
are preferred. Remember you should show the widget after add it to the
box:
builder.get_object('vbox1').pack_start(mywidget)
mywidget.show()
If your widget is composed of multiple sub widgets, you should use:
mywidget.show_all()
> The reason is that I have a custom widget, and I want to add it to my UI
> using code. (I couldn't add it to Glade's catalog. Glade's Doc didn't help)
>
> Thanks in advanced.
>
> _______________________________________________
> Glade-users maillist - Glade-users at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/glade-users
>
>
More information about the Glade-users
mailing list