Skip to main content

High level API wrapper around inputs library for working with input devices like gamepads, joysticks, etc.

Project description

input_devices

input_devices is a Python library designed to provide a high-level API for interacting with various electronic input devices. This includes game controllers (such as Xbox and PlayStation controllers), joysticks, remote controllers, as well as computer peripherals like keyboards and mice. The goal of input_devices is to simplify the process of integrating these devices into Python projects by offering a straightforward and unified interface.

Features

  • Game Controllers: Support for Xbox Gen4 controllers.

Future

  • Joysticks: Compatibility with various models of joysticks.
  • Remote Controllers: Integration with different types of remote control devices.
  • Computer Peripherals: Support for keyboards and mice, facilitating complex input handling.
  • Extensible: Designed to be easily extendable for more types of devices.

Installation

Install input_devices using pip:

pip install input_devices

Quick Start

Here is a simple example of how to use input_devices to listen for inputs from an Xbox controller:

from input_devices import XboxControllerGen4
from inputs import get_gamepad

#event subscription example
controller = XboxControllerGen4(get_gamepad())
controller.A.on_press(lambda: print("A pressed")) \
          .on_release(lambda: print("A released"), lambda: print("A released x2")) 

# interaction with different types of buttons
controller.directional_pad.up.on_press(lambda: print("D-pad up press"))
controller.directional_pad.left.on_release(lambda: print("D-pad down release"))

while True:
     # updating events and trigger states
     controller.update() 
     # getting mapped x axis value from left stick on the xbox controller
     print(controller.left_stick.get_mapped_x(), new_minimum=-1, new_maximum=1) 
     # getting raw y values from left trigger on the xbox controller
     print(controller.left_trigger.get_y()) # get pressure-sensitive input

Documentation

For more detailed information about using input_devices, refer to the full documentation. Contributing

input_devices is an open project, and contributions are welcome! If you have suggestions for improvements or new features, please feel free to fork the repository and submit a pull request, or contact me directly via email at mtik.philosopher@gmail.com. Contact

If you have any questions or comments about input_devices, please feel free to reach out to me:

Project by: Mark Tikhonov
Email: mtik.philosopher@gmail.com

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

input_devices-0.1.2.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

input_devices-0.1.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file input_devices-0.1.2.tar.gz.

File metadata

  • Download URL: input_devices-0.1.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for input_devices-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fe860e945ccc4582d92fcf1ed7004b46a761d32c3e8ed8487c5491e5cb5cbe10
MD5 1567982fa3c406a9e65c059b191d0d49
BLAKE2b-256 aff19a512de577adbb14beb74aa904eac9e35cfa872470396b18f880b4b21688

See more details on using hashes here.

File details

Details for the file input_devices-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: input_devices-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for input_devices-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4b5465d696d86d2b59dae3a0cd052269d6ac36d1a97cf4712394d213436e698c
MD5 b3667bb8b7679fb51041d23d156e2046
BLAKE2b-256 ccf3f8f9a575ac277ca753bc6044a9a2eca3dd2bab2a08ced3e5314d1146645f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page