1
I would like to keep a key pressed for x seconds. I know that pressing the button is:
pyautogui.press("key")
But how can I keep her pressed?
1
I would like to keep a key pressed for x seconds. I know that pressing the button is:
pyautogui.press("key")
But how can I keep her pressed?
1
As the very documentation says, the function press nothing more than a shortcut to the execution of the function keyDown followed by the function keyUP. That is, when performing the function keyDown, the key will be pressed until the function keyUp run. Thus, a simple example of holding down the left-facing arrow for 5 seconds would be:
x = 5
pyautogui.keyDown("left")
time.sleep(x)
pyautogui.keyUp("left");
Browser other questions tagged python python-2.7 pyautogui
You are not signed in. Login or sign up in order to post.