Is there any way to stop read_hotkey() programmatically?
See original GitHub issueread_hotkey()
will block and wait user presses and releases a hotkey, but is there any way to stop it with program?
I’m working on a program which allows users to input a hotkey from keyboard, and push a button to cancel hotkey input. So I need to stop blocking when the “cancel” button is pushed.
I have read whole API doc but can’t find a method to do it. Is anyone has an idea? Or maybe I miss something in the doc?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to Stop a Python Script (Keyboard and Programmatically)
One of the most common methods to stop a script is by using the following keyboard shortcut, which is known as KeyboardInterrupt :....
Read more >How do I programmatically get the shortcut keys reserved by ...
One thing I want to do is warn if a shortcut key is chosen that is already in use by Mac OS X....
Read more >Manage shortcuts | Android Developers
Disable shortcuts · disableShortcuts() , which removes the specified shortcuts from the static and dynamic shortcuts list and disables any pinned ...
Read more >Programmatic shortcuts manipulation - part 1
So a very easy way to programmatically affect the shortcuts is to update ... remove the possibly-existing shortcut using removeShortcut() ...
Read more >Customize keyboard shortcuts - Microsoft Support
Press the SHIFT+TAB key repeatedly until the cursor is in the Current keys box. Press DOWN ARROW or UP ARROW to select the...
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
That’s exactly what I was suggesting! Not a bad idea at all.
You could make the solution a bit cleaner by using a
threading.Event
object instead of an array holding a boolean. This would help communicating to future programmers (including yourself in the future) how this feature works; but the actual bytecode that will be executed is practically identical.I actually use something similar in the hotkey hooks with a custom class and adding extra attributes, but in that case it’s not justified and feels hacky. The new version won’t have that anymore.
Good luck!
I’ll go ahead and close the ticket. The answer to the title question is “not yet, but it’s planned”.