import win32gui
import win32con
taskbar = win32gui.FindWindow('Shell_TrayWnd', None)
trayArea = win32gui.FindWindowEx(taskbar, None, 'TrayNotifyWnd', None)
win32gui.SetForegroundWindow(taskbar)
win32gui.SendMessage(trayArea, win32con.WM_SETFOCUS, 0, 0)
Putting the focus on the tray icons in Windows XP using Python