PyDirectInput is designed to be a drop-in replacement for PyAutoGUI. It shares the same function interfaces, allowing you to substitute it into existing PyAutoGUI scripts where inputs are being ignored by DirectX-based software.
Note: While the interfaces are the same, PyDirectInput may not implement all optional parameters (like duration, tween, or logScreenshot) found in PyAutoGUI.
import pyautogui
import pydirectinput
# Mouse operations
pydirectinput.moveTo(100, 150) # Move to absolute coordinates
pydirectinput.click() # Click at current location
pydirectinput.click(200, 220) # Click at absolute coordinates
pydirectinput.move(None, 10) # Move relative to current position (10 pixels down)
pydirectinput.doubleClick() # Double click
# Keyboard operations
pydirectinput.press('esc') # Press a single key
pydirectinput.keyDown('shift')
pydirectinput.keyUp('shift')