Monitoring Function keys on Windows?

Matt Gerrans mgerrans at mindspring.com
Sun Mar 9 17:05:57 EST 2003


You can use win32api.GetKeyState() - like so:

>>> import win32api, win32con
>>> win32api.GetKeyState( win32con.VK_F7 )
0
>>> win32api.GetKeyState( win32con.VK_F7 )  # While holding down F7 key.
-127

By the way, look in the Win32 extensions help for this kind of thing.   You
can find that here:

  C:\Python22\Lib\site-packages\win32\Help\PythonWin32Extensions.hlp

Or someplace similar, depending upon what version and where you installed
Python and the Python Win32 extensions.

- Matt

"Wayne Pierce" wrote:
> I have been looking for documentation on how to listen to a system
> wide Function key, say F7.  Does anyone know how this is done or where
> I should be looking?
>
> I did some searching but nothing even remotely close came up.
>
> Thanks for any help,
>
> Wayne






More information about the Python-list mailing list