Skip to main content

Getting input from Microsoft XBox 360 controllers via the XInput library on Windows.

Project description

cc.XboxController

Getting input from Microsoft XBox 360 controllers via the XInput library on Windows.

Installation

pip install cc-xboxcontroller

Usage

import time

from cc.xboxcontroller import XboxController, Hand

def main():
    """
    """
    stick = XboxController(0)

    while True:
        stick.update()
        stick.setRumble(Hand.LEFT, abs(stick.axes["LTrigger"]))
        stick.setRumble(Hand.RIGHT, abs(stick.axes["RTrigger"]))
        print("A Btn:", stick.getAButton(), end="")
        print("\tD-pad:", stick.getDPad(), end="")
        print("\tX Axis:", stick.getX(Hand.LEFT))
        time.sleep(.01)


if __name__ == "__main__":
    main()

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

cc.xboxcontroller-2023.12.26.tar.gz (6.6 kB view hashes)

Uploaded Source

Built Distribution

cc.xboxcontroller-2023.12.26-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

Supported by

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