Last but not least, we get to the code. PyMailGUI consists of the new modules listed near the start of this chapter, along with a handful of peripheral files described there. The source code for these modules is listed in this section. Before we get started, here are two quick reminders to help you study:
Besides the code here, PyMailGUI also gets a lot of
mileage out of reusing modules we wrote earlier and won’t repeat
mailtools for mail
loads, composition, parsing, and delete operations;
threadtools for managing server and
local file access threads; the GUI section’s
TextEditor for displaying and editing
mail message text; and so on. See the example numbers list
earlier in this chapter.
In addition, standard Python modules and packages such as
tkinter standard library module also
implements GUI components in a portable fashion.
As mentioned earlier, PyMailGUI applies code factoring and OOP to leverage code reuse. For instance, list view windows are implemented as a common superclass that codes most actions, along with one subclass for the server inbox list window and one for local save-file list windows. The subclasses customize the common superclass for their specific mail media.
This design reflects the operation of the GUI itself—server list windows load mail over POP, and save-file ...