I\'m currently working on a script that presses the \'w,a,s,d\' keys in order to move a character in any game.
For this to work, i need to have the \'
As said in the doc-string from pyautogui.keyDown()
:
Performs a keyboard key press without the release. This will put that key in a held down state.
NOTE: For some reason, this does not seem to cause key repeats like would happen if a keyboard key was held down on a text field.
You need a different approach - you can may use pygame - with this
Or, if you want to stay with pyautogui
you can try something like this:
def hold_W (hold_time):
import time, pyautogui
start = time.time()
while time.time() - start < hold_time:
pyautogui.press('w')