Ultimately, though, PyMailGUI serves to illustrate just how far the combination of
GUIs, networking, and Python can take us. Like all Python programs, this system is
scriptable—once you’ve learned its general structure, you can easily change it to work
as you like, by modifying its source code. And like all Python programs, this one is
portable—you can run it on any system with Python and a network connection, without
having to change its code. Such advantages become automatic when your software is
coded in an open source, portable, and readable language like Python.
Source Code Modules and Size
This chapter is something of a self-study exercise. Because PyMailGUI is fairly large
and mostly applies concepts we’ve already learned, we won’t go into much detail about
its actual code. Instead, it is listed for you to read on your own. I encourage you to
study the source and comments and to run this program live to get a feel for its oper-
ation; example save-mail files are included so you can even experiment offline.
As you study and run this program, you’ll also want to refer back to the modules we
introduced earlier in the book and are reusing here, to gain a full understanding of the
system. For reference, here are the major examples that will see new action in this
chapter:
Example 13-21: PP4E.Internet.Email.mailtools (package)
Server sends and receives, parsing, construction (Client-side scripting chapter)
Example 10-20: PP4E.Gui.Tools.threadtools.py
Thread queue management for GUI callbacks (GUI tools chapter)
Example 10-16: PP4E.Gui.Tools.windows.py
Border configuration for top-level window (GUI tools chapter)
Example 11-4: PP4E.Gui.TextEditor.textEditor.py
Text widget used in mail view windows, and in some pop ups (GUI examples
chapter)
Some of these modules in turn use additional examples we coded earlier but that are
not imported by PyMailGUI itself (textEditor, for instance, uses guimaker to create its
windows and toolbar). Naturally, we’ll also be coding new modules here. The following
new modules are intended to be potentially useful in other programs:
popuputil.py
Various pop-up windows, written for general use
messagecache.py
A cache manager that keeps track of mail already loaded
wraplines.py
A utility for wrapping long lines of messages
mailconfig.py
User configuration parameters—server names, fonts, and so on (augmented here)
1006 | Chapter 14: The PyMailGUI Client