34 Glade: GUI Builder

glade is a graphical user interface (GUI) builder for creating your own applications using the GTK+ (GIMP ToolKit) and GNOME toolkits. It provides a visual tool (c.f. Visual Basic) to interactively create the GUI on a canvas from components (widgets) provided by the toolkits. Interfaces can be rapidly developed and source code in a variety of languages can be automatically generated. glade directly generates C source code with support for C++, Ada95, Python, Perl, and Eiffel available within glade via external tools. Alternatively, and often preferably, libglade can be used to dynamically create the user interface directly from the XML data at run time, leading to much simpler code.

As with many GNOME products glade’s native save format is an open standard XML (gzip compressed) allowing the interface to be modified, transformed, and viewed by many other XML tools (or even edited manually in your favourite text editor if desired). Independent applications exist that allow differently structured C source code to be generated directly from the XML data.

In this chapter we will illustrate the use of Glade and Libglade with the Python language, which is a simple to learn and easy to use programming language. We begin with an overview of using Python to generate GUIs directly in GTK+, and then using Glade. We then proceed through the development of a sample glade application by way of a walk-through that will build the interface. This is followed by walk-throughs that will turn this interface into a fully functional application. These walk-throughs begin with a C implementation and include packaging the application for distribution using the GNU packaging tools (automake, autoconf, and tar). We then walk through the use of the libglade library as an alternative for C. Versions of the application in Python and C++ are also presented. We complete this chapter with reference sections covering all aspects of glade and some basics of the Gtk+ and GNOME toolkits.

Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0