Which Shell Command Can I Use In Windows (XP Or Older) To Bring Me The Print Picture Dialog?
Solution 1:
You can call win32api.ShellExecute
with the "print"
verb. An example: http://timgolden.me.uk/python/win32_how_do_i/print.html
Solution 2:
At least on my Windows system (Windows 7), there seems to be no trivial way to achieve this. I found that a naive call to ShellExecute appeared to do nothing. Then I tried this:
import time, win32api
win32api.ShellExecute(0, "print", "test.jpg", None, None, 0)
time.sleep(5)
With the addition of the call to sleep()
the dialog appeared, but when the python process terminated, the print dialog closed too.
Since the print dialog runs in-process I don't see an easy wait to wait on it. If it were to run as a separate process then it would be trivial to wait on that process.
I suppose a hacky solution would be to run this through pythonw
so that no console appeared, and put in a long sleep. You might end up with some stray Python processes that were aimlessly sleeping, but that might not matter.
Post a Comment for "Which Shell Command Can I Use In Windows (XP Or Older) To Bring Me The Print Picture Dialog?"