Hi I'm trying to do something like following:
while True:
do something
if key = q is been hold but not released and key = ctrl is been hold and key = shelf is been hold:
break
time.sleep(0.008333)#run it at 120fps
I googled around and unable to find a tool that gives you the power to check if a key has been held or not. The most is press or release? Press means the moment key from been released changed to on hold. Release means the moment key changed from on hold from released. It's a fraction of time very hard to capture. But on hold is a continuous state, it should be easy to capture.
Then I found pynput. Looks like it's also a loop. But I don't know how to run 2 loops simultaneously. One loop to do my stuff. One loop to monitor the keys then set some flag?
Or I can run the loop like this?
while True:
do something()
monitor key board for 0.00833333 seconds.
But I don't know how to just run pynput for just 0.0083333 seconds...
Please help?