Alex Rivera | Logout

How can I maximize a specific window with Python?

Asked 2010-05-07T18:32:40.677
16

I'm trying to maximize a specific window with python...

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

I'm using this command

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

that works perfectly, but only with the focus window... and the second window of firefox witch opens with the script doesnt get focused...

Edit
Report

1 Answer

29

This should work

import win32gui, win32con

hwnd = win32gui.GetForegroundWindow()
win32gui.ShowWindow(hwnd, win32con.SW_MAXIMIZE)
answered 2010-05-07T21:03:53.537

Your Answer