from tkinter simpledialog import askstring from tkinter filedialog import saveasopendirectory from tkinter messagebox import showinfoshowerroraskyesno reuse book examples from pp gui tools import windows from pp gui tools import threadtools from pp internet email import mailtools from pp gui texteditor import texteditor window borderexit protocols thread callback queue checker load,send,parse,build utilities component and pop up modules defined here import mailconfig import popuputil import wraplines import messagecache import html text import pymailguihelp user paramsserversfontsetc helpbusypasswd pop-up windows wrap long message lines remember already loaded mail simplistic html->plaintext extract user documentation def printstack(exc_info)""debuggingshow exception and stack traceback on stdout change to print stack trace to real log file if print to sys stdout failsit does when launched from another program on windowswithout this workaroundpmailgui aborts and exits altogetheras this is called from the main thread on spawned thread failureslikely python bugit doesn' occur in or and the traceback object works fine if print to fileoddlythe print(calls here work (but go nowhereif spawned""print(exc_info[ ]print(exc_info[ ]import traceback trytraceback print_tb(exc_info[ ]file=sys stdoutok unless spawnedexceptlog open('_pymailerrlog txt'' 'use real file log write('-'* else gui may exit traceback print_tb(exc_info[ ]file=login xnot thread busy counters for threads run by this gui sendingbusy shared by all send windowsused by main window quit loadinghdrsbusy threadtools threadcounter(deletingbusy threadtools threadcounter(loadingmsgsbusy threadtools threadcounter(sendingbusy threadtools threadcounter(only only poss many poss many listwindowsmessage list windows the code in example - implements mail index list windows--for the server inbox window and for one or more local save-mail file windows these two types of windows look and behave largely the sameand in fact share most of their code in common in pymailgui implementation