0

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:

  1. 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.
  2. 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.

  • take a look at https://stackoverflow.com/questions/13207678/whats-the-simplest-way-of-detecting-keyboard-input-in-a-script-from-the-termina –  May 09 '22 at 10:44
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community May 09 '22 at 11:37

1 Answers1

0

You need to use keyboard hook for that, for example keyboard library

mugiseyebrows
  • 4,138
  • 1
  • 14
  • 15