Skip to main content

pydirectinput_rgx

This library is a fork of https://github.com/learncodebygaming/pydirectinput 1.0.4

This package extends PyDirectInput in multiple ways. It fixes some bugs, adds the remaining missing input functions that still required using PyAutoGUI and provides additional keyword-only arguments to give more precise control over function behavior.

Contrary to the upstream PyDirectInput package, this package intends to replace PyAutoGUI almost completely for basic usage, skipping more advanced options like logging screenshots and custom tweening functions. This should reduce the need to install both PyDirectInput and PyAutoGUI side-by-side and thereby keep the number of dependencies to a minimum.

This library is fully in-line type-annotated and passes mypy --strict. Unfortunately, that also means this package only works on Python 3.7 or higher. There are no plans to backport changes to older versions.

This is why this package is available standalone and uses the same package name. There's no reason to use both side-by-side. Once Python's type annotations have reached wider adoption, this package may be merged back and integrated upstream. Until that moment, this package exists to fill that gap.

Okay, but what is PyDirectInput in the first place?

PyDirectInput exists because PyAutoGUI uses older and less compatible API functions.

In order to increase compatibility with DirectX software and games, the internals have been replaced with SendInput() and Scan Codes instead of Virtual Key Codes.

For more information, see the original README at https://github.com/learncodebygaming/pydirectinput

Installation

pip install pydirectinput-rgx

Provided functions with same/similar signature to PyAutoGui:

  • Informational:
    • position()
    • size()
    • onScreen()
    • isValidKey()
  • Mouse input:
    • moveTo()
    • move() / moveRel()
    • mouseDown()
    • mouseUp()
    • click() and derivatives:
      • leftClick()
      • rightClick()
      • middleClick()
      • doubleClick()
      • tripleClick()
    • scroll() / vscroll()
    • hscroll()
    • dragTo()
    • drag() / dragRel()
  • Keyboard input:
    • keyDown()
    • keyUp()
    • press()
    • hold() (supports context manager)
    • write() / typewrite()
    • hotkey()

Additionally, keyboard input has been extended with :

  • low-level scancode_* functions that allow integer scancode as arguments:
    • scancode_keyDown()
    • scancode_keyUp()
    • scancode_press()
    • scancode_hold() (supports context manager)
    • scancode_hotkey()
  • higher-level unicode_* functions that allow inserting Unicode characters into supported programs:
    • unicode_charDown()
    • unicode_charUp()
    • unicode_press()
    • unicode_hold() (supports context manager)
    • unicode_write() / unicode_typewrite()
    • unicode_hotkey()

Missing features compared to PyAutoGUI

  • logScreenshot arguments. No screenshots will be created.
  • tween arguments. The tweening function is hardcoded at the moment.

Changelog compared to forked origin point PyDirectInput version 1.0.4:

  • Adding/fixing extended key codes
  • Adding flake8 linting
  • Adding mypy type hinting and adding annotations (This makes this fork Python >=3.7 only!)
  • Adding scroll functions based on https://github.com/learncodebygaming/pydirectinput/pull/22 and improve them
  • Adding hotkey functions based on https://github.com/learncodebygaming/pydirectinput/pull/30 and improve them
  • Adding more available keyboard keys
  • Adding optional automatic shifting for certain keayboard keys in old down/up/press functions
  • Adding additional arguments for tighter timing control for press and typewrite functions
  • Adding Unicode input functions that allow sending text that couldn't be sent by simple keyboard
  • Adding Scancode input functions that allow lower level access to SendInput's abstractions
  • Adding support for multi-monitor setups via virtual resolution (most functions should work without just fine)
  • Adding support for swapped primary mouse buttons
  • Adding duration support for mouse functions
  • Adding sleep calibration for mouse duration
  • Adding automatic disabling of mouse acceleration for more accurate relative mouse movement
  • Increase documentation

This library uses in-line type annotations that require at least Python version 3.7 or higher and there are no plans to make the code backwards compatible to older Python versions!


See the pydirectinput's original README.


Metadata

Release files for pydirectinput_rgx 2.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydirectinput_rgx 2.0.3
File Size Uploaded
pydirectinput_rgx-2.0.3.tar.gz 32.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydirectinput_rgx 2.0.3
File Interpreter ABI Platform
pydirectinput_rgx-2.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 63.3 kB

Release files / pydirectinput_rgx-2.0.3.tar.gz

Download URL pydirectinput_rgx-2.0.3.tar.gz
Size 32.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fcabd10f7c8e37e783aa0ea4db7c2a3543c686c5eea9aa605e743cf5904c3f82
BLAKE2b-256 checksum
How to use checksums
f1432506beece6ee3a2a88929ad616876c10098acad9567b5795a0babba65dd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release files / pydirectinput_rgx-2.0.3-py3-none-any.whl

Download URL pydirectinput_rgx-2.0.3-py3-none-any.whl
Size 30.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb5a11f67ba921e29d066f9cb6f60a84836999e0c481a5fef29892a8b4d06e6d
BLAKE2b-256 checksum
How to use checksums
adb085d7f937e54bb96578463e971d2184fbf2f296b8f88f36cf6bdc13b0ca3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release history Release notifications | RSS feed

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.8

2 release files

2.0.7

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

This release

2.0.3 This release

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page