Newbie Printing Question

Larry Bates lbates at syscononline.com
Mon Mar 28 09:54:24 EST 2005


If it is a print that can take direct character output (e.g. one
that has PCL or text mode emulation) you can do following:

lpr=open('LPT1','w') # or LPT2, LPT3
lpr.writeline('the output line you want')
lpr.close()

If it is a GDI-only printer it is MUCH more difficult.  You need
to interface with Windows GDI.  If this is the case, take a look
at wxPython interface to wxWindows (see printPreview) or you can
use Mark Hammonds Windows utilities.

FYI, Larry


Richard Lyons wrote:
> I'm just starting to work with Python.  Have had a little experience
> with basic.  I am using Python on a Windows XP system.
> How to I print a line of output generated in a python script to a
> printer attached to the windows computer?



More information about the Python-list mailing list