[Tutor] Printing to a parallel port
Jacob S.
keridee at jayco.net
Thu Sep 23 05:29:19 CEST 2004
Hi,
I'm an intermediate python prgrammer -- I do things like command apps for simple tasks like creatings zip files, copying files, computing things like area, etc. Also, I have used VPython to create a function graphing program, etc. Ugh, enough about me ---- I would like to know if there is a way in Python to send a string to a printer on a parallel port or usb port. I do have one idea, but it's messy.
Ex. --
import os
ask = raw_input('What string do you want to print? ')
filetoprint = open( 'Temp.txt ' ,'w' )
filetoprint.write( ask )
filetoprint.close()
batch = open( 'print.bat','w' )
batch.write( 'Temp.txt > LPT1' )
batch.close()
os.startfile( 'print.bat' )
os.remove( 'Temp.txt' )
os.remove( 'print.bat' )
## End example
Soo, I was wondering if there was a way to print directly -- without writing the batch file, etc.
Thanks...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040922/0b2a9ef8/attachment.html
More information about the Tutor
mailing list