[pygtk] Replacing a widget using libglade?

Rafael Villar Burke pachi at rvburke.com
Wed Jan 23 03:18:22 WST 2008

Bil Simser wrote:
> Hi guys,
> I’m trying to figure out how to leverage libglade with my pygtk app. I
> have a window that contains a vbox with menu at the top and status bar
> at the bottom. I have a custom widget in code (inherited from
> gtk.DrawingArea) that I want to slip in between the menu and status
> bar. I’m not sure how I can do this without just ignoring the glade
> file and loading the widgets manually into a new vbox. I tried just
> adding in a stock DrawingArea widget onto my glade form and replacing
> it with something like this:
> self.stockDrawingArea = self.widgets.get_widget(“drawingAreaPlaceHolder”)
> self.stockDrawingArea = CustomDrawingArea()
> but of course that just assigns the object twice.
> I can do something like this in my code:
> Vbox = gtk.Vbox()
> Vbox.pack_start(widgets.get_widget(“menuBar”))
> Vbox.pack_start(CustomDrawingArea())
> Vbox.pack_start(widgets.get_widget(“statusBar”))
> But that seems like I’m misusing glade.
> Any suggestions?
Have a look to the "Custom PyGTK widgets in Glade 3" I and II articles
by Ali Afshar, which you can find in his blog or
You'll be able to use glade to design the UI using your own custom
widget without the need to reparent an existing placeholder or using
your current trick.

Have fun,

Rafael Villar Burke

More information about the pygtk mailing list