pyautogui keydown code example

Example 1: python hotkey pyautogui

>>> pyautogui.press('enter')  # press the Enter key
>>> pyautogui.press('f1')     # press the F1 key
>>> pyautogui.press('left')   # press the left arrow key

Example 2: pyautogui moveTo overtime

import pyautogui

#pyautogui.moveTo(X, Y, Seconds)
pyautogui.moveTo(100, 100, 2) #Move to X=100, Y=100 over a 2 seconds period

Example 3: pyautogui send keys

>>> pyautogui.typewrite('Hello world!\n', interval=secs_between_keys)  # useful for entering text, newline is Enter