Ben Chuanlong Du's Blog

It is never too late to learn.

Get Information of Application Windows in Python

Tips

  1. PyGetWindow does not support Linux currently.

Installation

pip3 install pyobjc-framework-quartz pygetwindow
In [1]:
import pygetwindow as pygw
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-1-d13e25ae8407> in <module>
----> 1 import pygetwindow as pygw

~/.local/lib/python3.7/site-packages/pygetwindow/__init__.py in <module>
    346 else:
    347     raise NotImplementedError(
--> 348         "PyGetWindow currently does not support Linux. If you have Xlib knowledge, please contribute! https://github.com/asweigart/pygetwindow"
    349     )

NotImplementedError: PyGetWindow currently does not support Linux. If you have Xlib knowledge, please contribute! https://github.com/asweigart/pygetwindow
In [ ]:
 

PyGetWindow.getAllTitles

PyGetWindow.getWindowGeometry

Get the geometry information (x, y, w, h) of a window, where (x, y) is the coordinate of the upper-left pixle of the window and w and h are the width and height of the window. The bounding box of the window can be calculated as (x, y, x + w, y + h).

PyGetWindow.getActiveWindow

PyGetWindow.getWindowsAt

PyGetWindow.isMinimized

pyGetWindow.isVisible

pyGetWindow.pointInRect

pyGetWindow.activate

In [ ]:
 

Comments