Thanks for the prompt reply. This is exactly what I am looking for.
However, I have tried the code on the page and I can't get it to work.
import tempfile
import win32api
filename = tempfile.mktemp (".txt")
open (filename, "w").write ("This is a test")
win32api.ShellExecute (
0,
"print",
filename,
None,
".",
0
)
I am using the Pythoncard code editor and I get the following error:
Traceback (most recent call last):
File "c:\python24\jhc.py", line12, in ?
0
pywintypes.error: (2, 'ShellExecute', 'The system cannot find the file
specified
.')
I have played about with it and saved it in various places but I can't get
it to work. Any suggestions? Do I need to import other modules? Do I need
to use Pythonwin?
Thanks,
John.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Danny Yoo
Sent: 24 December 2005 19:33
To: John Corry
Cc: Tutor
Subject: Re: [Tutor] Printing
> I have downloaded win32, win32com, Preppy and PIL. I have had a go at
> using them but can't get them to work. At the moment I can't even print
> the text file.
>
> Is there a good helpguide/FAQ page which deals with printing text files
> or is there simple code which prints a text file?
Hi John,
Let's see... ok, found it! Tim Golden has written a small introduction to
printing:
http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html
His recommendation is to use the ShellExecute function in win32api to send
off documents to your printer.
Best of wishes!
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor