set foreground window python code example
Example 1: get screen size python
>>> import pyautogui
>>> width, height= pyautogui.size()
>>> print(width)
1366
>>> print(height)
768
Example 2: get active window title python
import win32gui
w=win32gui
w.GetWindowText (w.GetForegroundWindow())