How can I enlarge a specific window using Python?

I am trying to maximize a specific window using python ...

Here is the deal: I have a script that opens 2 firefox windows (selenium rc), and I need to enlarge the second window, the last one that opens ... How can I do this?

I use this command

window = win32gui.GetForegroundWindow() win32gui.MoveWindow(window, 0, 0, 1440, 900, True) 

which works fine, but only with a focal window ... and the second firefox witch window opens using a script that does not focus ...

+4
source share
1 answer

This should work

 import win32gui, win32con hwnd = win32gui.GetForegroundWindow() win32gui.ShowWindow(hwnd, win32con.SW_MAXIMIZE) 
+10
source

Source: https://habr.com/ru/post/1309140/


All Articles