Printing in a generic way - like the rest of Python

Anders J. Munch andersjm at dancontrol.dk
Wed May 14 03:56:02 EDT 2003


"David Broadwell" <anti-spam.dbroadwell at mindspring.com> wrote:
> > There are, however, simple text applications that can be hijacked for
> > this purpose.  Try
> >
> >     os.system("notepad /p filename.txt")
> 
> The only disadavantage is that is has to open notepad to actually do that.
> 
> something else to test is;
> 'type filename.txt > PRN'
> 
> Which will re-direct to your default printer.

prn: is an alias for lpt1:, which may have nothing to do with your
default printer.

> 
> This is just annother of those things that windows dosen't really have.
> 

Eh no, printing is something that MS Windows does basically right.
Teletype emulation is not something to strive for.

> And makes me wonder if anyone is good enough at C/C++ to write a simple one
> to python interface with.

More to the point, does anyone have the inclination to do so?

Locate PrintDlg, StartDoc, EndDoc, StartPage, EndPage, TextOut,
GetDeviceCaps and TextExtent in win32all (CreateFont and SelectObject
for extra credit), and it should be doable without much C skills.

Note that wxPython has cross-platform printing.

- Anders







More information about the Python-list mailing list