You can use the
win32gui.GetForegroundWindow function to get a handle to the active window. You can check this handle against the Vizard window handle to determine whether Vizard has focus:
Code:
import win32gui
def VizardHasFocus():
return win32gui.GetForegroundWindow() == viz.window.getHandle()
if VizardHasFocus():
print 'Vizard has focus'
else:
print 'Vizard does not have focus'