You can use the library pygetwindow
. To install it, just type:
Pip install Pygetwindow
For starters, import pygetwindow
and then get the window using the function getWindowsWithTitle(title)
. There are other functions to get a window, but I recommend this, because here you just need to put the window title.
After that, you can use the method resizeTo(newWidth,newHeight)
to resize the window and method activate()
to make the window appear. See this example below:
import pygetwindow
title = 'Stack Overflow em Português - Google Chrome'
window = pygetwindow.getWindowsWithTitle(title)[0]
window.activate()
window.resizeTo(1280,720)
Exactly what I was looking for, thank you very much
– Gabriel Henrique