Newbie Printing Question

R

Richard Lyons

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?
 
L

Larry Bates

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top