0

If a user clicks on multiple keys, it will print 'key1 + key2' and should print any key pressed on the keyboard. How would I go about this? I want it to work with any key, even function and F keys.

For example, a user clicks the keys shift and F12. Shift + F12 was pressed gets printed. Any help is appreciated.

ahmedquran12
  • 164
  • 1
  • 6
  • 19
  • In order to get the keys combinations, you should display the message when a key is released, and check if another key is pressed at the same time. – D_00 Mar 25 '21 at 11:35
  • i found a similar question w/ an answer [the answer](https://stackoverflow.com/a/17807994/15477801) – SimonDev Mar 25 '21 at 11:37
  • @SimonDev the question im asking is related to keyboard input from a physical input – ahmedquran12 Mar 25 '21 at 11:45
  • @D_00 how would I go abouts doing this? – ahmedquran12 Mar 25 '21 at 11:45
  • Idk I think this is the first step (you didn't know how and what to do; now you know what to do, but not how do to it) -- hope it's clear – D_00 Mar 25 '21 at 11:47
  • You could use [pynput](https://pynput.readthedocs.io/en/latest/keyboard.html) to get the pressed and released keys, or [`pygame.event`](https://www.pygame.org/docs/ref/event.html) to get keys combinations. – D_00 Mar 25 '21 at 11:49
  • I have approached a similar solution, it's just that with some keys it prints a 3 digit code. – ahmedquran12 Mar 25 '21 at 11:49

0 Answers0