Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glade or no glade: What is the best way to use PyGtk?

I've been learning python for a while now with some success. I even managed to create one or two (simple) programs using PyGtk + Glade.

The thing is: I am not sure if the best way to use GTK with python is by building the interfaces using Glade.

I was wondering if the more experienced ones among us (remember, I'm just a beginner) could point out the benefits and caveats of using Glade as opposed to creating everything in the code itself (assuming that learning the correct gtk bindings wouldn't exactly be a problem).

like image 395
Flávio Amieiro Avatar asked Sep 07 '08 04:09

Flávio Amieiro


3 Answers

I would say that it depends: if you find that using Glade you can build the apps you want or need to make than that's absolutely fine. If however you actually want to learn how GTK works or you have some non-standard UI requirements you will have to dig into GTK internals (which are not that complicated).

Personally I'm usually about 5 minutes into a rich client when I need some feature or customization that is simply impossible through a designer such as Glade or Stetic. Perhaps it's just me. Nevertheless it is still useful for me to bootstrap window design using a graphical tool.

My recommendation: if making rich clients using GTK is going to be a significant part of your job/hobby then learn GTK as well since you will need to write that code someday.

P.S. I personally find Stetic to be superior to Glade for design work, if a little bit more unstable.

like image 60
Boris Terzic Avatar answered Sep 29 '22 08:09

Boris Terzic


Use GtkBuilder instead of Glade, it's integrated into Gtk itself instead of a separate library.

The main benefit of Glade is that it's much, much easier to create the interface. It's a bit more work to connect signal handlers, but I've never felt that matters much.

like image 25
John Millikin Avatar answered Sep 29 '22 08:09

John Millikin


Glade is very useful for creating interfaces, it means you can easily change the GUI without doing much coding. You'll find that if you want to do anything useful (e.g. build a treeview) you will have to get familiar with various parts of the GTK documentation - in practice finding a good tutorial/examples.

like image 23
8128 Avatar answered Sep 29 '22 06:09

8128