I was using PyUserInput on windows and was trying to simulate different kind of input.
(py27, win64)
I tried something like this:
import ...
k = pykeyboard.PyKeyboard()
k.press_key('a')
k.press_key('b')
time.sleep(2)
k.release_key('a') # line a
k.release_key('b') # line b
And I want it to help me play games like 'osu!' or something similar.
In this game, it requires player to do the key pressing and releasing with the rythm of music, and one of the rythm pattern looks like above.
However, I found that this script cannot perform line a or b as I expected, which is something like pressing key 'a' and 'b' at the same time, and after exactly 2 seconds, I release both of them.
As indicated from the game, I knew that one of the key 'a' and key 'b' was never released, until the next time I used k.press_key('a') .
How may I fix the problem ? I have tried something like this:
import ...
a = pykeyboard.PyKeyboard()
b = pykeyboard.PyKeyboard()
a.press_key('a')
b.press_key('b')
time.sleep(2)
a.release_key('a')
b.release_key('b')
and it's not working.
By the way, I encountered the long press problem, as PyKeyboard cannot simulate something like one was pressing the really keyboard in a text field, which would display like 'aaaaaaaaaaaaaaaaaa'. Though It seemingly had no infulence on my game, as the game thought I was pressing the key, I guess there may be something influencing both of my questions.
I was using
PyUserInput
on windows and was trying to simulate different kind of input. (py27, win64)I tried something like this:
And I want it to help me play games like 'osu!' or something similar. In this game, it requires player to do the key pressing and releasing with the rythm of music, and one of the rythm pattern looks like above.
However, I found that this script cannot perform line a or b as I expected, which is something like pressing key 'a' and 'b' at the same time, and after exactly 2 seconds, I release both of them. As indicated from the game, I knew that one of the key 'a' and key 'b' was never released, until the next time I used
k.press_key('a')
.How may I fix the problem ? I have tried something like this:
and it's not working.
By the way, I encountered the long press problem, as
PyKeyboard
cannot simulate something like one was pressing the really keyboard in a text field, which would display like 'aaaaaaaaaaaaaaaaaa'. Though It seemingly had no infulence on my game, as the game thought I was pressing the key, I guess there may be something influencing both of my questions.Thanks!