Keyboard module hotkeys not working after locking windows

61 views Asked by At

After locking windows then logging back in, the keyboard module is no longer working.

I have tried refreshing the hotkeys by unbinding and then rebinding them, but that does still not seem to work.

1

There are 1 answers

0
Paul On

The default add hotkeys like this:

  keyboard.add_hotkey("f6", hotkey_pressed)

no longer worked after I would press ctrl+alt+delete or windows+l.

I was able to solve this issue with this:

 Keyboard.hook_key("f6", lambda e:hotkey_pressed(str(e)))
 def hotkey_pressed(e):

      if 'down' not in e: return
      print('pressed')