{"id":24316,"library":"pydirectinput","title":"PyDirectInput","description":"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.","status":"maintenance","version":"1.0.4","language":"python","source_language":"en","source_url":"https://github.com/learncodebygaming/pydirectinput","tags":["automation","input","directinput","windows","game","keyboard","mouse"],"install":[{"cmd":"pip install pydirectinput","lang":"bash","label":"default"}],"dependencies":[{"reason":"Required for SendInput API calls","package":"pywin32","optional":false}],"imports":[{"wrong":"import pydirectinput","symbol":"pydirectinput","correct":"import pydirectinput"}],"quickstart":{"code":"import pydirectinput\nimport pyautogui\n\n# Move mouse relative (works in DirectX)\npydirectinput.moveRel(100, 0)\n\n# Click at current position\npydirectinput.click()\n\n# Type text\npydirectinput.write('Hello World', interval=0.1)\n\n# Press key\npydirectinput.press('enter')\n\n# Hold key\npydirectinput.keyDown('shift')\npydirectinput.keyUp('shift')","lang":"python","description":"Basic mouse and keyboard automation using direct input simulation. Note: PyDirectInput overrides pyautogui's functions, so you can use both together."},"warnings":[{"fix":"Use conditional imports: if sys.platform == 'win32': import pydirectinput","message":"PyDirectInput is Windows-only. It will fail on macOS or Linux with ImportError.","severity":"breaking","affected_versions":"all"},{"fix":"Consider using pynput for cross-platform needs; stick with PyDirectInput for DirectX game automation.","message":"The community fork 'pynput' or 'mouse' libraries may be preferred for cross-platform, but PyDirectInput remains best for DirectX games.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Test your input strings on a text field first. For special characters, map them to keys using keyDown/keyUp.","message":"PyDirectInput does not support all keyboard characters; complex Unicode or Korean/Japanese characters may not work. Use write() with ASCII characters only.","severity":"gotcha","affected_versions":"all"},{"fix":"Import pydirectinput after pyautogui if you want to override, or import pydirectinput as a separate namespace: import pydirectinput as di","message":"If you install both pyautogui and pydirectinput, pydirectinput will override pyautogui's functions globally. This can break code expecting pyautogui behavior.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'1.0.4':28 '2021':30 'activ':32 'applic':25 'autom':6,36 'bypass':17 'current':26 'develop':33 'direct':14 'directinput':38 'directx':22 'game':23,40 'input':10,15,37 'keyboard':9,41 'librari':4 'limit':18 'mous':7,42 'pyautogui':20 'pydirectinput':1 'python':3 'sendinput':16 'stabl':35 'updat':29 'use':13 'version':27 'window':12,39","created_at":"2026-05-01T08:12:25.959472+00:00","updated_at":"2026-05-01T08:12:25.959472+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\n  File \"/tmp/tmpjrfeebqk/venv/lib/python3.12/site-packages/pydirectinput/__init__.py\", line 6, in <module>\n    SendInput = ctypes.windll.user32.SendInput\n                ^^^^^^^^^^^^^\nAttributeError: module 'ctypes' has no att"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.0.4","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/learncodebygaming/pydirectinput","docs":null,"changelog":null,"pypi":"https://pypi.org/project/pydirectinput/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":[],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}