Mar-07-2018, 02:28 AM
Hello,
So Pynput works great when you want to type characters, strings etc, it's great.
However, for a reason I cannot understand, when you want to use the feature of pynput elsewhere, it doesn't seems to work.
An example, if you're in a video game, and you want to crouch with the "C" key, it won't make you crouch, but if you're using the chat system of the online game, it will write "C"s.
There's also some flash games online when you just have to press the spacebar as fast as possible, and it doesn't work. (or only one space is recorded sometimes).
I tried to look up the documentation but I couldn't find anything about it.
Here's the piece of code I wrote:
Could anyone help me try to figure out why it doesn't work ? And how could I fix this issue ?
Thank you !
So Pynput works great when you want to type characters, strings etc, it's great.
However, for a reason I cannot understand, when you want to use the feature of pynput elsewhere, it doesn't seems to work.
An example, if you're in a video game, and you want to crouch with the "C" key, it won't make you crouch, but if you're using the chat system of the online game, it will write "C"s.
There's also some flash games online when you just have to press the spacebar as fast as possible, and it doesn't work. (or only one space is recorded sometimes).
I tried to look up the documentation but I couldn't find anything about it.
Here's the piece of code I wrote:
from pynput.keyboard import Key, Controller import time import keyboard as key keyboard = Controller() time.sleep(2) for i in range(30): #keyboard.press(Key.space) #keyboard.release(Key.space) keyboard.press("c") keyboard.release('c') time.sleep(0.1)I tried playing with the time.sleep value but it doesn't change anything.
Could anyone help me try to figure out why it doesn't work ? And how could I fix this issue ?
Thank you !