Richard Peeters wrote:
>
> Tks for reply , but decided to go other way.
> The following code prints "Hello world" about an inch down on page at
> left margin.
> I can change the hoirizontal position from left to right but the
> vertical only a few inches down the page.
> What are the coordinates to cover a complete page?

    width = hDC.GetDeviceCaps( win32con.HORZRES )
    height = hDC.GetDeviceCaps( win32con.VERTRES )

That returns you the surface size in pixels.  If you plan to work in
twips, you'll have to convert it.

    widthtwips = hDC.GetDeviceCaps(win32con.HORZRES ) * 1440 /
    hDC.GetDeviceCaps(win32con.LOGPIXELSX)
    heighttwips = hDC.GetDeviceCaps(win32con.VERTRES ) * 1440 /
    hDC.GetDeviceCaps(win32con.LOGPIXELSY)

By the way, you wrote:

    INCH = 1440  # twips - 1440 per inch allows fine res

Working in twips doesn't increase the resolution in any way.  You can't
get any finer than pixels.  It's just a little more convenient.  If
you're going to use the "INCH" constant anyway, you could just leave the
mapping mode alone, and do

    INCH = hDC.GetDeviceCaps(win32con.LOGPIXELSX)

Now positive Y increases going down, which is a bit more natural.

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to