Registry / pydirectinput

pydirectinput

JSON →
library1.0.4pypypiunverified

A Python library for automating mouse and keyboard input on Windows using Direct Input (SendInput), bypassing limitations of pyautogui in DirectX games and applications. Current version: 1.0.4, updated 2021. No active development, but stable.

pip install pydirectinput
INSTALL
IMPORT
SIG · PYDIRECTINPUT
P
pydirectinput
pythonv1.0.4
Install
1.5s avg
Import
—
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.0.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pydirectinput
✓ import pydirectinput
✗ import pydirectinput

Basic mouse and keyboard automation using direct input simulation. Note: PyDirectInput overrides pyautogui's functions, so you can use both together.

import pydirectinput import pyautogui # Move mouse relative (works in DirectX) pydirectinput.moveRel(100, 0) # Click at current position pydirectinput.click() # Type text pydirectinput.write('Hello World', interval=0.1) # Press key pydirectinput.press('enter') # Hold key pydirectinput.keyDown('shift') pydirectinput.keyUp('shift')
Debug
Known issues
breakingPyDirectInput is Windows-only. It will fail on macOS or Linux with ImportError.
fix
Use conditional imports: if sys.platform == 'win32': import pydirectinput
affects: all
deprecatedThe community fork 'pynput' or 'mouse' libraries may be preferred for cross-platform, but PyDirectInput remains best for DirectX games.
fix
Consider using pynput for cross-platform needs; stick with PyDirectInput for DirectX game automation.
affects: >=1.0.0
gotchaPyDirectInput does not support all keyboard characters; complex Unicode or Korean/Japanese characters may not work. Use write() with ASCII characters only.
fix
Test your input strings on a text field first. For special characters, map them to keys using keyDown/keyUp.
affects: all
gotchaIf you install both pyautogui and pydirectinput, pydirectinput will override pyautogui's functions globally. This can break code expecting pyautogui behavior.
fix
Import pydirectinput after pyautogui if you want to override, or import pydirectinput as a separate namespace: import pydirectinput as di
affects: all
Upgrade
Version history
1.0.4latest on PyPI · released Feb 2, 2021
Audit
Dependencies
pywin32requiredRequired for SendInput API calls
Agent activity
23 hits · last 30 days
node
18
Resources
pydirectinput — pip install pydirectinput · libregistry