GNOME Panel Appletsby Daniel Solin
Greetings Pythonists and fans of British humor. Today, we're going to take a look at a great little Python module called PyGNOME. With this piece of software in hand, we can, without fear of being forced to use some other uncomfortable programming language, dive into the big world of GUI (Graphical User Interface) programming. You see, PyGNOME gives us a complete Python interface for dealing with the GNOME (GNU Network Object Model Environment) development/desktop environment. In this article, we will take a closer look at something called panel applets, which are essential elements on the GNOME desktop. Panel applets are usually developed in C, but this article will teach you how to use PyGNOME to develop GNOME panel applets with Python!
What is GNOME?
This question may sound trivial to some of you, but the answer is not that obvious. Most people think of GNOME as a modern desktop environment. While that is true, GNOME is much more than a desktop environment; it is also a complete framework for GUI development. The GNOME development framework provides libraries and components that programers can use to easily build standardized GUI applications and utilities. And, in addition to a desktop environment and GUI development standard, GNOME is also a large set of free software, including everything from word processors to CD players. All these software components follow the GNOME standard, and they therefore look and act basically the same.
What are GNOME panel applets?
The GNOME desktop comes with the panel, the bar that is located at the bottom of your GNOME desktop. From the panel, you can access your menus and quick-launchers. In addition, the panel can hold small programs, usually referred to as applets. Applets are programs designed to run inside another program. They are mini-applications. GNOME panel applets run on the panel instead of in a window of their own. If, however, you ignore the difference in where they are located, panel applets are just like any other program. Everything you can implement in a "real" GNOME program can also be implemented in a panel applet. (Although, when developing an applet you will have a much smaller area of the screen to work with).
So, why would you want to develop applets instead of real GNOME applications? Well, this depends on what kind of program you want to create. If you're out to develop an advanced office suite a la StarOffice, or a spreadsheet program like Microsoft Excel, panel applets are not for you! On the other hand, if you want to develop a CD or MP3 player, and you want to be able to control this program all the time, no matter what other programs you're running, you should probably do it as a panel applet. This is the whole idea with panel applets: to have access to certain programs permanently, without having to bother about minimizing and/or maximizing other windows. The panel is always visible, and therefore so are the applets on the panel.
Figure 1. Taskbar applet with the Gimp currently running (click for full view).
Figure 1 shows a typical GNOME panel. The elements on this panel are, from left to right, the GNOME menus, four launchers, the pager applet, the taskbar applet (with The Gimp currently running), and the date/time applet (currently showing the time 12:54 PM).
What we want to do is to create a program that resides on the panel, just as the pager, taskbar, and date/time applets do in Figure 1.