python detect what window is currently selected code example
Example: get active window title python
import win32gui
w=win32gui
w.GetWindowText (w.GetForegroundWindow())
import win32gui
w=win32gui
w.GetWindowText (w.GetForegroundWindow())