We’ll put GuiMaker to more practical use in instances such as the PyEdit example in
Chapter 11. The next section shows another way to use GuiMaker’s templates to build
up a sophisticated interface, and serves as another test of its functionality.
BigGui: A Client Demo Program
Let’s look at a program that makes better use of the two automation classes we just
wrote. In the module in Example 10-4, the Hello class inherits from both GuiMixin and
GuiMaker. GuiMaker provides the link to the Frame widget, plus the menu/toolbar con-
struction logic. GuiMixin provides extra common-behavior methods. Really, Hello is
another kind of extended Frame widget because it is derived from GuiMaker. To get a
menu and toolbar for free, it simply follows the protocols defined by GuiMaker—it sets
the menuBar and toolBar attributes in its start method, and overrides makeWidgets to
put a custom label in the middle.
Example 10-4. PP4E\Gui\Tools\big_gui.py
"""
GUI demo implementation - combines maker, mixin, and this
"""
import sys, os
from tkinter import # widget classes
from PP4E.Gui.Tools.guimixin import # mix-in methods: quit, spawn, etc.
from PP4E.Gui.Tools.guimaker import * # frame, plus menu/toolbar builder
Figure 10-2. GuiMaker self-test at work
GuiMaker: Automating Menus and Toolbars | 609