[Tutor] Improving printouts from IDLE

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Mon Jun 27 20:34:10 CEST 2005


On Mon, 27 Jun 2005, Richard Lyons wrote:

> What is the specific code that allows the IDLE window to be printed to
> notepad (in Windows XP)?

Hi Richard,

The relevant code that does the "Print Window" command lives in the
IOBinding submodule of IDLE, within the print_window() method:

http://cvs.sourceforge.net/viewcvs.py/python/python/dist/src/Lib/idlelib/IOBinding.py?view=markup

where it appears that IDLE will delegate the paper printing of a window's
contents by using Notepad, using the following (in config-main.def)

    start /min notepad /p %s

>From what I can tell so far, it looks relatively straightforward.



> Given the difficulties that I've found trying to print from Python, I
> was just commenting this week-end on the efficiency of the printing
> process used in IDLE.

According to the source code, IDLE just passes text through notepad
directly, with no fontification.

But since the command is actually a configuration option, it's very
possible to reconfigure the system to first pass that code through a
beautification process.  Hmm... it sounds like an interesting weekend
project to get high-quality source output from IDLE.


Best of wishes!



More information about the Tutor mailing list