How can I get the coordinates of the upper left corner of the window of another application using Python?

  • Does Python have windows? You But seriously, a little more detail is desirable, what is the window for? Those. what a system, what a gooey package ... - alexlz

1 answer 1

Use the pywinauto module

import pywinauto pwa_app = pywinauto.application.Application() w_handle = pywinauto.findwindows.find_windows(title_re=u'calc', class_name='SciCalc')[0] window = pwa_app.window_(handle=w_handle) rect = window.Rectangle() print print rect.left() 

For this library there is a graphical utility that allows you to scan through the properties of windows and generate python code. - SWAPY

And I am a little author of this utility.

  • thanks, I will try - PSem