Use the GetForegroundWindow Win32 API to get a window handle.
Then use the MoveWindow (or SetWindowPos , if you prefer) win32 API to resize the window.
Working with the Win32 API can be done directly using ctypes and working with dll or using the pywin32 project.
Edit: Of course, here is an example ( Make sure pywin32 is installed ):
import win32gui hwnd = win32gui.GetForegroundWindow() win32gui.MoveWindow(hwnd, 0, 0, 500, 500, True)
Brian R. bondy
source share