[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版

(yzsuai) #1

account parameters from the mailconfig module listed later in this chapter, so be sure
to change this file to reflect your email account parameters (i.e., server names and
usernames) if you wish to use PyMailGUI to read your own email. Unless you can guess
the book’s email account password, the presets in this file won’t work for you.


The account password parameter merits a few extra words. In PyMailGUI, it may come
from one of two places:


Local file
If you put the name of a local file containing the password in the mailconfig mod-
ule, PyMailGUI loads the password from that file as needed.


Pop up dialog
If you don’t put a password filename in mailconfig (or if PyMailGUI can’t load it
from the file for whatever reason), PyMailGUI will instead ask you for your pass-
word anytime it is needed.


Figure 14-7 shows the password input prompt you get if you haven’t stored your pass-
word in a local file. Note that the password you type is not shown—a show='*' option
for the Entry field used in this pop up tells tkinter to echo typed characters as stars (this
option is similar in spirit to both the getpass console input module we met earlier in
the prior chapter and an HTML type=password option we’ll meet in a later chapter).
Once entered, the password lives only in memory on your machine; PyMailGUI itself
doesn’t store it anywhere in a permanent way.


Figure 14-6. PyMailGUI attached PyEdit info box


1026 | Chapter 14: The PyMailGUI Client

Free download pdf