34.2 Using Glade

Together with the GTK toolkit GNOME provides an extensive collection of user interface building blocks called widgets. These are components like text fields, labels, numeric entries, check buttons, menus, and so on.

In your programming language of choice you access these widgets to compose a graphical user interface for your application. This often involves careful programming to place your widgets correctly and to associate code with actions that are performed on the widget (such as clicking on a button).

glade simplifies this task by providing a GUI-based GUI-builder. With glade you choose widgets from a graphical palette of available widgets and place them onto your evolving application window (the canvas). You edit the properties associated with the widgets through another graphical interface where you also add the appropriate connections between your widgets and externally written code. This is done by identifying the names of functions that will be called when a widget receives a signal. For example, you can associate a function that you might call on_button1_clicked with the ``clicked’’ signal associated with a button). These functions (callbacks) you code up in your programming language of choice, whether that be C, C++, Ada95, Python, Perl, or Eiffel.

When you are happy with how the interface looks you will either generate the source code that implements the interface you have created or else you will use a library (libglade) that directly loads the saved description of the interface at run time and dynamically creates it.

Your main coding task is to write your callbacks (the functionality behind the interface) and the associated support functions.



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