Glade is a program designed to enable the quick building of graphical user interfaces for GTK+ and Gnome applications. However, it can be used with any desktop environment in linux, as long as the gtk+ and/or gnome libaries are installedHow is Glade Used?
Glade is used in two ways:
To create the GUI with Glade itself
To load *.glade files (xml) with libglade and create the GUI on the fly
What Glade can and cannot do:
Glade develops the GUI and associated code
It creates empty callbacks and signal handlers to link the frontend GUI with the backend of the application
Glade doesn't develop the 'backend' of your application
Glade is not a complete IDE, in other words it does not include a compiler, editor or debugger. It is used in conjunction with these, for example with gvim as the editor, gcc as the compiler and gdb as the debugger. There are several IDEs for Linux that work with, or attempt to work with Glade. Anjuta is one.
Glade Interviews are getting tough these days as the technology grows faster. To get through the Glade interview one needs to update him/herself in a regular manner. Having said that, just before the interview, it is very important to have a quick glance of the reputed Glade questions and answers to make yourself comfortable during the interview process. This is where DoAnswers.com helps you in renewing yourself on Glade and various other technologies interview preparation.
1. How do I get my 1.2 gladefiles to work with 2.0?
There is a program included with libglade 2.0.x called libglade-convert that will do a pretty good job at converting the interface file to the new format. You should be able to edit the file in glade 1.1 after that. Dave notes that you will probably have to redo all your dialog boxes, since they are going to be converted without some of the GTK 2 things, such as the correct active area interface and GTK 2 button images. You'll also have to redo your trees and lists to conform with GTK 2. A moderately sized project will take around 8 hours to do this to. Even if you don't "make install" libglade 2.0.x, you can use the Python file included (but renamed) in the distribution.
2. How do I use PyGTK and glade together (using libglade)?
For a more in depth answer see the Glade articles at [www.pygtk.org] Basically, the steps involved are: 1. Create your interface with glade, and save the XML file (say, foo.glade). 2. Implement the relevant code using gtk.glade: import gtk.glade # instantiate XML object tree = gtk.glade.XML("foo.glade") # get references to individual widgets w1 = tree.get_widget("window1") e1 = tree.get_widget("entry1") Some explaining is due. First, by instantiating an gtk.glade.XML object, you are actually parsing the glade file in runtime. The XML instance abstracts the glade widget tree, which is why it's often named "tree" or "wTree" in examples. It's important to understand that by creating an XML instance you are in fact *generating the UI*, and all widgets will be created in this step. To deal with visibility issues, see FAQ 22.6. The most important method in the XML instance is get_widget(), which returns widgets defined in your glade file by name. Glade assigns names by default, and the pattern is usually ; in the example above we are using the default widget names for a GtkWindow and a GtkEntry. You are advised to change these names to something that makes sense for your application to avoid going insane performing code maintenance.