最佳答案
您可以使用 ctypes 加载 user32.dll 然后调用 GetKeyState与 nVirtKey = VK_CAPITAL (0x14)
def get_capslock_state():
import ctypes
hllDll = ctypes.WinDLL ("User32.dll")
VK_CAPITAL = 0x14
return hllDll.GetKeyState(VK_CAPITAL)
关于Python 3.x - 在 Windows 上获取 caps-lock/num-lock/scroll-lock 的状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21160100/