Whats the best way to execute some code after certain keys have been pressed?
See original GitHub issueFirst of all thanks for this! I am relatively new to python and i just discovered “keyboard” and i think it’s awesome.
I am struggling to find elegant way how to make some code to be executed if certain keys have been pressed (not one) for example… if the user pressed f1, w, (do something) or… shift+`, w, e, (do something)
Would you use the record feature here or the world listener or something else?
Thank you
Issue Analytics
- State:
- Created 5 years ago
- Comments:7
Top Results From Across the Web
JS function when keyboard key is pressed? - Stack Overflow
Part 1: Where to put the scriptblock? To capture over the entire page, like as a page-help-function (maybe you want to capture F1?)...
Read more >Keyboard: keydown and keyup - The Modern JavaScript Tutorial
Pressing a key always generates a keyboard event, be it symbol keys or special keys like Shift or Ctrl and so on. The...
Read more >JavaScript Keycode List – Keypress Event Key Codes for ...
The keydown event has the maximum coverage of keys to produce the contextual information. The keypress event works only for a subset of...
Read more >How to Detect a Sequence of Keystrokes in JavaScript
To save the sequence of entered keys we need to add a variable that will store that sequence and which we can update...
Read more >Use JavaScript to Detect What Key the User Pressed
In some apps and games it may be necessary to enable certain ... The event listener logs the code, which has been converted...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Indeed, this is how you would go about it. Example:
IIRC you can use commas in the string to listen for consecutive presses, e.g. “shift+e, r, f”