'Detecting spacebar pressing outside the window and deactivating further inputs (Python)
So, I am a Python enthusiast and I want to make a spacebar trecking app (using PyQt). Let's say I want my programm to detect spacebar pressing, play a sound and then deactivate any futher pressings of this key for 30 seconds. My 2 main questions are:
- How do I even catch key event outside the main window? I heard PyQt don't have such features itself, but there is some additional libraties to help it. Sadly, I don't know which one to use, what exactly I need to code and etc.
- Deactivating the spacebar for other programms is also not an easy task I believe. The only thing I know how to do is a 30 seconds timer and that's it.
I think my app should somehow mess with a keyboard as a device or a system itself, but I know absolutely nothing about how Windows handles inputs. So I came here for help. Help me please
PS I haven't been working with PyQt for nearly six months and it doesn't help either.
Solution 1:[1]
You need to use keyboard hook for that, for example keyboard library
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mugiseyebrows |
