Home arrow Python arrow Page 3 - Deleting Email and More with the PyMailGUI Client

Multiple Windows and Status Messages - Python

Continuing our tour through PyMailGUI, this week we show you how to delete email, explain POP message numbers and synchronization, and finally begin talking about the code. This article, the fourth of six parts, is excerpted from chapter 15 of the book Programming Python, Third Edition, written by Mark Lutz (O'Reilly, 2006; ISBN: 0596009259). Copyright © 2006 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

  1. Deleting Email and More with the PyMailGUI Client
  2. POP Message Numbers and Synchronization
  3. Multiple Windows and Status Messages
  4. PyMailGUI Implementation
By: O'Reilly Media
Rating: starstarstarstarstar / 1
August 02, 2007

print this article



Note that PyMailGUI is really meant to be a multiple-window interface—a detail not made obvious by the earlier screenshots. For example, Figure 15-36 shows PyMailGUI with the main server list window, two save-file list windows, two message view windows, and help. All these windows are nonmodal; that is, they are all active and independent, and do not block other windows from being selected. This interface looks slightly different on Linux and the Mac, but it has the same functionality.

Figure 15-36.  PyMailGUI multiple windows and text editors

In general, you can have any number of mail view or compose windows up at once, and cut and paste between them. This matters, because PyMailGUI must take care to make sure that each window has a distinct text-editor object. If the text-editor object were a global, or used globals internally, you’d likely see the same text in each window (and the Send operations might wind up sending text from another window). To avoid this, PyMailGUI creates and attaches a newTextEditorinstance to each view and compose window it creates, and associates the new editor with the Send button’s callback handler to make sure we get the right text.

Finally, PyMailGUI prints a variety of status messages as it runs, but you see them only if you launch the program from the system command-line console window (e.g., a DOS box on Windows or an xterm on Linux), or by double-clicking on its filename icon (its main script is a .py, not a .pyw). On Windows, you won’t see these messages when PyMailGUI is started from another program, such as the PyDemos or PyGadgets launcher bar GUIs. These status messages print server information, show mail loading status, and trace the load, store, and delete threads that are spawned along the way. If you want PyMailGUI to be more verbose, launch it from a command line and watch:

  C:\...\PP3E\Internet\Email\ PyMailGui>PyMailGui2.py
user: pp3e
  loading headers
  +OK NGPopper vEL_6_10 at earthlink.net ready<7044.1139211610@poptawny.atl.sa.
  load headers exit
  synch check
  +OK NGPopper vEL_6_10 at earthlink.net ready <22399.1139211626@pop-tawny.atl.sa.
  Same headers text
  load 16
  +OK NGPopper vEL_6_10 at earthlink.net ready <27558.1139211627@pop-tawny.atl.sa.
  Sending to...['pp3e@earthlink.net']
  From: pp3e@earthlink.net
  To: pp3e@earthlink.net
  Subject: Fwd: Re: America MP3 file
  Date: Mon, 06 Feb 2006 07:41:05 -0000
  X-Mailer: PyMailGUI 2.1 (Python)

  --Mark Lutz (http://www.rmi.net/~lutz)

  > -----Original Message-----
  > From: pp3e@earthlink.net
  Send exit

You can also double-click on the PyMailGui.py filename in your file explorer GUI and monitor the popped-up DOS console box on Windows. Console messages are mostly intended for debugging, but they can also be used to help understand the system’s operation.

For more details on using PyMailGUI, see its help display, or read the help string in the modulePyMailGuiHelp.py, listed in Example 15-9 in the next section.

>>> More Python Articles          >>> More By O'Reilly Media

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Python Big Data Company Gets DARPA Funding
- Python 32 Now Available
- Final Alpha for Python 3.2 is Released
- Python 3.1: String Formatting
- Python 3.1: Strings and Quotes
- Python 3.1: Programming Basics and Strings
- Tuples and Other Python Object Types
- The Dictionary Python Object Type
- String and List Python Object Types
- Introducing Python Object Types
- Mobile Programming using PyS60: Advanced UI ...
- Nested Functions in Python
- Python Parameters, Functions and Arguments
- Python Statements and Functions
- Statements and Iterators in Python

Developer Shed Affiliates


Dev Shed Tutorial Topics: