FW: Printing images through Python

Tim Golden tim.golden at viacom-outdoor.co.uk
Mon Oct 6 04:03:46 EDT 2003


> From: Kevin [mailto:other at cazabon.com]
> Sent: 04 October 2003 03:21
> To: tim.golden at viacom-outdoor.co.uk
> Subject: Re: Printing images through Python
> 
> Thanks for the help Tim, seems to work well!

Only too glad I could save someone the hours of frustrating
 search it took me to get that far.

> One problem I had though, just FYI: 
> turned out that printer_resolution[1] was a 
> function... have to do more looking to figure out why.

Blowed if I can see why; it's just the return value from GetDeviceCaps.
Ah... looking at my email to you underneath yours to me, the line has
been chopped (hope this makes it across the email systems) thus:

printer_resolution [...] = hDC.GetDeviceCaps [unintended line break]
(VERTRES)

which will make Python think that the second value in
the printer_resolution tuple is the function GetDeviceCaps 
and that the (VERTRES) is merely a throwaway value. 
It should, of course, read:

[...] = hDC.GetDeviceCaps (VERTRES)

where VERTRES is the parameter to GetDeviceCaps

> I just used [0] for both args and it was fine(for now).

That'll work because, in any case, the code later on takes
the smaller of the two ratios to determine the scaling factor,
and printer_resolution[0] is the width of the page, which
is going to be the smaller of the two anyway.

Hope it works out for you. I haven't yet bothered to go
into using the Printer Setup dialogue, which truly is a
pain. I'm using a Pygame interface, so I'm trying to cut
down on Windows-esque dialog boxes.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________





More information about the Python-list mailing list