Next / Previous / Contents / Shipman's homepage

3. Design notes

Before proceeding, be sure you have a basic understanding of how Tkinter applications are built. Strongly recommended is the author's Tkinter 8.5 reference: a GUI for Python.

This program has a lot of widgets. To keep the design conceptually simple, the architecture of the program uses boxes within boxes within boxes, grouping related widgets into frames, and related frames into larger frames, so that each grouping has a well-defined function, and connections within a grouping of widgets are hidden within a single Python class.

One way to describe this technique is that we build compound widgets out of Tkinter's basic widgets. A compound widget is a Python class that inherits from the Frame widget.

This application uses the .grid() geometry manager to position widgets. At the very highest level, the application is organized into two rows and three columns like this:

The three columns of row 0 are spanned to make one wide, short grid cell that contains the general controls. The name .menuBar has a dot in front of it because it is an attribute of the Application class, the Frame that contains all the application's widgets. The compound widget that appears in this grid cell is an instance of class MenuBar; see Section 12, “class MenuBar: General controls”.

Similarly, three compound widgets fill out row 1. Column 0 contains a NamePicker compound widget, which is stored in attribute .namePicker of the Application class. Column 1 is an Adjuster widget, and column 2 is a Swatch widget.

Below this level, design of each of the four major areas proceeds by stepwise refinement. Here is a diagram showing the layout of all the compound widgets in this program.

The actual code for huey starts in Section 4, “Code prologue”. The actual program logic starts with Section 5, “main(): The main program”.