[pygtk] more languages

Guillaume Proux guillaume.proux at scala.com
Thu Aug 18 23:04:30 WST 2005

The solution I used after trying a couple of different things.

I created a wrapper around a Glade tree object.
When I load the glade tree, I look for all widget ids starting with a 
given prefix like TEXT_.

For each widget (of id TEXT_nameofwidget), I look in a localization file 
  for the text associated to the widget ( nameofwidget="Open File..." 
for example) and I set the text for the corresponding widget. (Sometimes 
this does not work and you need to set the text of the first child 
widget but in general it is ok. Also when using pango syntax you have to 
call ANOTHER different method to set the text but it works well once you 
have covered all bases).

Also wrapping a GLade tree object enables you add a __getattr__ method 
to the wrapper to obtain the widget by name directly doing something like


Makes life MUCH simpler to drive complex interaction on the UI.



More information about the pygtk mailing list