Python pyautogui window handle

Is there any other Python module that supports this kind of functionality?

https://github.com/pywinauto/pywinauto

https://pywinauto.readthedocs.io/en/latest/#some-similar-tools-for-comparison

enter image description here


PyAutoGui itself says, in its documentation's FAQ section,

Q: Can PyAutoGUI figure out where windows are or which windows are visible? Can it focus, maximize, minimize windows? Can it read the window titles?

A: Unfortunately not, but these are the next features planned for PyAutoGUI. This functionality is being implemented in a Python package named PyGetWindow, which will be included in PyAutoGUI when complete.

Now, if you go on over to PyGetWindow's repo, you'll see there's no code there yet, but there is a random_notes.txt file, with this pointer:

Finding window titles on Windows:

http://stackoverflow.com/questions/37501191/how-to-get-windows-window-names-with-ctypes-in-python

which has some interesting information. (I haven't tried it yet.)


This code might help to get what window you want to minimize or maximize. Example: If you want to get a Chrome window titled "Stack Overflow",

    pyautogui.getWindowsWithTitle("Stack Overflow")[0].minimize()

Or if you want to minimize or maximize any file explorer window that titled "music", the same thing applies.

    pyautogui.getWindowsWithTitle("music")[0].maximize()

If you are not sure about which window you require, you can get a list using this