pythonpython-3.xwxpython

Wxpython detect caps lock status


I'm build a GUI in wxPython (Python 3). How can I detect if Caps Lock is on or off? Something like this code but with CapsLock.

event.CmdDown()

Solution

  • I found a nice way to check it:

    from win32api import GetKeyState
    from win32con import VK_CAPITAL
    def caps_on():
        return GetKeyState(VK_CAPITAL) == 1