Chapter 22. Gui Design in the Baroque Age

Table of Contents
Types of gui customization
Faking it with bitmaps
Creating themes with QStyle

One of the greatest achievements of GUI interfaces such as CDE, Windows or MacOS is the uniform look and feel of the applications. Once a user has learned to use one application effectively, he will be familiar with the way all applications work on that platform. Of course, there are also users who complain they forget exactly which application they are working with when all applications look the same. Be that as it may, the current trend, perhaps initiated with the wide variety of design for websites, is toward ever-more distinctive and baroque interfaces. Indeed, we seem to be entering the age of the ‘designer' interface, and PyQt offers everything we need to create database applications in the form of an audio rack or spreadsheets in the form of a medieval book of hours.

Types of gui customization

Despite the slight banter in the introduction, there are many valid reasons to design a gui for your application that diverges from the platform standard. For instance, while a word processor shouldn't look like the desk of a medieval scribe, the paste-board gui used in an application like Adobe FrameMaker is very effective, especially since many layout designers are still familiar with the glue-and-scissors approach of creating a layout. Likewise, designing an mp3-player that looks a bit like an audio rack is effective (while making it look like an angry fish-eye is less so). Generally speaking, creating an interface that matches closely the real world experience of your users is a good idea.

There is another area where a custom gui would fit well: the general redesign, or theming of the whole set of widgets, to make them more esthetically pleasing to your users. Qt already offers a selection of those themes. Your user can decide whether they want their applications to look like Motif, CDE, Silicon Graphics IRIX, Windows 95 or MacOS 9. Offering this choice means that the applications you make can always blend in unobtrusively with the other applications your users use. A toolkit like Tkinter does not offer this advantage; a user will always be aware that he or she is not working with a application native to his computing environment.

There are two ways to create a totally custom interface. You can reimplement QWidget using pixmaps and masks, or you can use the PyQt QStyle mechanism to reimplement the drawing routines of the standard widgets like QPushButton.

The first solution is applicable for simple applications like audio players or for applications that need to be totally skinnable (again, like audio players). You need also to reimplement QWidget if you have designed a totally new type of widget, like Adobe did with the PageMager paste-board. (You can also simulate the pasteboard quite easily with QCanvas, but you might have an idea for a widget that's more complicated than this.)