Testing the example applet
Figure 2. A simple applet running on the GNOME panel (click for full view).
It's time to test our new, unbelievably advanced and sophisticated (ehrm...) applet. To start it, you do as you would with any other Python program:
If everything is in place, the applet should now start and be visible on your panel. Of course, you need to have the GNOME panel running for this to work. Figure 2 shows our simple applet running on a GNOME panel.
Figure 3. The standard applet-menu (click for full-size view).
Our applet is the "O'Reilly" label with the frame around it, between the taskbar and the date/time applet. It has no functions or features, but it's our applet! However, all applets have a standard applet-menu. To see this, click with your right mouse button somewhere on the applet. From the menu that now pops up, you can remove or move the applet and also add other applets to the panel. This menu is also shown in Figure 3.
To bring up the tooltip, hold your mouse pointer over the applet for a little while. A tooltip like the one shown in Figure 4 should show up.
That was that, congratulations to your first PyGNOME applet!
Figure 4. The tooltip menu.
This article has taught you the basics of GNOME panel applet development with Python and the PyGNOME module. Although we have only touched the surface of this quite large subject, you should now have a basic understanding of what GNOME panel applets are, and when/why they are good.
When developing applets, it's important to remember that you can implement everything in an applet that you can in a "real" GNOME program; every GNOME/Gtk+ widget or feature can be used in an applet. Remember, a good panel applet can do everything a larger program can, it will just have the advantage of always being accessible. Did anyone say size matters? C'mon, get serious!
Daniel Solin is a freelance writer and Linux consultant whose specialty is GUI programming. His first book, SAMS Teach Yourself Qt Programming in 24 hours, was published in May, 2000.
Discuss this article in the O'Reilly Network Python Forum.
Return to the Python DevCenter.