-1

In my program I use pynput to control my mouse and keyboard. Everything else working as intended but I cannot find the syntax to reference using the Num Lock key on my keyboard

keyboard.press(Key.nmlk)

This is my current guess at what the syntax might be (nmlk). Can anyone please guide me to finding the right word or work around to be able to press the number lock key?

Thank you

MattDMo
  • 100,794
  • 21
  • 241
  • 231
  • 1
    The _syntax_ is right, but why are you guessing the value? https://github.com/moses-palmer/pynput/blob/fbf5268ad46efd622e15465f1b44c6a9047bf81f/lib/pynput/keyboard/_base.py#L306:L307 – jonrsharpe Aug 19 '21 at 15:28
  • Stack Overflow is not intended to replace existing documentation. Next time, please try e.g. putting `pynput num lock` [into a search engine](https://duckduckgo.com/?q=pynput+num+lock); when I try this, I get the linked duplicate as the second result, and the relevant documentation as the third; and if I scroll a little further I can even find a [fully worked tutorial example](https://gist.github.com/alexandrecvieira/2a3a9ab6402ae6dac974673b6a4dae23). – Karl Knechtel Aug 19 '21 at 15:31

1 Answers1

1

According to the official docs, they NumLock key is called num_lock.

MattDMo
  • 100,794
  • 21
  • 241
  • 231