asweigart / PyGetWindow

A simple, cross-platform module for obtaining GUI information on applications' windows.
BSD 3-Clause "New" or "Revised" License
362 stars 69 forks source link

window.box, etc, provides incorrect information. #37

Closed Tyrannosaurus1234 closed 3 years ago

Tyrannosaurus1234 commented 3 years ago

The window object dimension variables provide, for me, inaccurate information on Windows 10 x64, with window.left/topleft/box[0] being off by a full 8 pixels in the X axis. Possibly a DPI thing? I have a very normal setup at default (100%) DPI at 1920x1080.

To reproduce:

  1. make a window somewhere on screen
  2. call window.topleft, etc to get the top left corner of the window
  3. take a screenshot without moving anything
  4. paste the screenshot into an image editor and actually measure the position of the top left corner of the window
  5. compare what window.topleft told you with what you measured
Tyrannosaurus1234 commented 3 years ago

This turned out to be an error on my part caused by the win32gui::PrintWindow() window styling (window border, titlebar width, etc) being different from what I see on screen.