#1
|
|||
|
|||
Detecting Window Focus
Is there a native way in Vizard to detect if a windowed application has focus? I am trying to prevent user input events from being passed through to other windows applications, and I would like to have a method to tell the computer to stop listening to the input device when the Vizard window doesn't have focus.
|
#2
|
|||
|
|||
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' |
#3
|
|||
|
|||
Thank you. I will give that a try.
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Limit vizinfo message to only one window? | hotspur1 | Vizard | 1 | 05-07-2010 02:13 PM |
tkinter window focus | John P | Vizard | 4 | 08-31-2009 05:51 AM |
Full screen window changes to small window | tacbob | Vizard | 1 | 04-04-2007 09:30 AM |
How to get the window handle | Joran | Vizard | 1 | 06-16-2006 11:01 AM |
The error window that couldn't | FlyingWren | Vizard | 2 | 12-02-2003 08:23 AM |