Writing programs for the Raspberry Pi can be a fantastic way to learn a programming language, but not all programs are command-line based. In this blog, we will look at some of the various GUI libraries available for different languages.
Tkinter is arguably the de-facto library for Python programs, and it is supported by all platforms, including Windows, OS X, and Linux. Widgets available in Tkinter include (but are not limited to) button, canvas, check button, combo box, frames, labels, progress bars, scroll bars, and text.
Tkinter GUI example. Image courtesy of Wikipedia.
Qt is another popular GUI framework that includes all the basic widgets, and, unlike Tkinter, it is available for many language platforms, including Python, Java, and C. This gives the programmer more freedom of choice when creating a GUI program. But be warned: Qt was acquired by Nokia, and programs made using the Qt framework may fall under the Nokia GPL license!
Qt is widely used in commercial applications, and some common examples include Adobe Photoshop Album, Bitcoin Core, Google Earth, Skype, Teamviewer, and WPS Office.
Qt creator window. Image courtesy of Wikipedia.
Swing is a cross-platform GUI library written for Java-based programs, which means you cannot use other languages (this can be restricting for some programmers). But, the same applies to Tkinter, which is designed only for Python. Swing, a Java Foundation Class, provides many common GUI features, including buttons, labels, text, checkboxes, lists, combo boxes, input fields, and even file dialog boxes. Unlike AWT (another GUI library for Java), Swing-based programs will maintain their behavior and appearance when implemented on different platforms. Swing is also the most up-to-date GUI library; widgets can be given personalized appearances, and Swing widgets are more efficient than AWT widgets, which results in faster load times.
Example of a Swing GUI program written in Java. Image courtesy of Wikipedia.
GTK+, like Qt, is a hugely popular library for making GUI-based applications, and it is available for Python, C, and even Java! All the standard widgets, including buttons, sliders, and comb boxes, are available here. GTK+ is licensed under the GNU Lesser General Public License, which is advantageous. It allows both free and proprietary software to use it. GTK+ is used in a wide range of programs, including GNOME, AbiWord, Chromium, GIMP, Inkscape, and Pidgin.
GTK+ demo. Image courtesy of Wikipedia.
wxWidgets is another GUI library that is also cross-platform and available in many languages, including C, Python, and Java. Like GTK+, it is both free and open-source, which is good for those who wish to sell wxWidget-based programs. wxWidgets includes all the basic widgets, including buttons, text boxes, input fields, and scroll bars, which makes it a good choice for those who wish to create many GUI programs with features that are not fully realized (i.e., it’s good for expansion). wxWidgets is a very popular library, and it is used in many famous programs, including CodeBlocks, Audacity, Dolphin, FileZillar, KiCad, and Skyscraper Simulator.
CodeBlocks running wxWidgets. Image courtesy of Wikipedia.