Metadata-Version: 1.1
Name: xbox360controller
Version: 1.0.4
Summary: A pythonic Xbox360 controller API built on top of the xpad Linux kernel driver.
Home-page: https://github.com/linusg/xbox360controller
Author: Linus Groh
Author-email: mail@linusgroh.de
License: MIT
Download-URL: https://pypi.python.org/pypi/xbox360controller/
Description-Content-Type: UNKNOWN
Description: xbox360controller
        =================
        
            A pythonic Xbox360 controller API built on top of the xpad Linux
            kernel driver.
        
        |PyPI Version| |Build Status| |Code Health|
        
        This Python Package aims to provide a pythonic and complete API for your
        Xbox360 and similar game controllers. Currently it's built on top of the
        Linux kernel driver ``xpad`` so you can use it on almost any Linux
        distribution including your Rasperry Pi projects etc.
        
        The following features are supported:
        
        -  Registering callbacks for **all** Buttons, Axes, Triggers and Hat in
           a ``gpiozero``-inspired way
        -  Setting the LED circle; all ``xpad`` provided options are possible:
           blinking, rotating, setting individual LEDs on and off, ...
        -  Rumbling, both the left and right side can be controlled from 0 to
           100 percent
        
        Installation
        ------------
        
        You will most likely need Python 3.4 or above.
        
        Any Linux distribution:
        
        ::
        
            pip3 install -U xbox360controller
        
        You might also use a *virtual environment*, or do a per-user install by
        providing the ``--user`` flag to above command. Global installations
        might require the usage of ``sudo`` or working directly from a root
        shell but are **not recommended**.
        
        If the ``pip3`` command cannot be found, try ``pip`` or make sure to
        have pip installed properly:
        
        ::
        
            sudo apt-get install python3-pip
        
        Usage
        -----
        
        Basics
        ~~~~~~
        
        .. code:: python
        
            import signal
            from xbox360controller import Xbox360Controller
        
        
            def on_button_pressed(button):
                print('Button {0} was pressed'.format(button.name))
        
        
            def on_button_released(button):
                print('Button {0} was released'.format(button.name))
        
        
            def on_axis_moved(axis):
                print('Axis {0} moved to {1} {2}'.format(axis.name, axis.x, axis.y))
        
            try:
                with Xbox360Controller(0, axis_threshold=0.2) as controller:
                    # Button A events
                    controller.button_a.when_pressed = on_button_pressed
                    controller.button_a.when_released = on_button_released
        
                    # Left and right axis move event
                    controller.axis_l.when_moved = on_axis_moved
                    controller.axis_r.when_moved = on_axis_moved
        
                    signal.pause()
            except KeyboardInterrupt:
                pass
        
        The above code will run until ``Ctrl+C`` is pressed. Each time on of the
        left or right axis is moved, the event will be processed. Additionally,
        the events of the A button are being processed. Please note, there seems
        to be a bug left that the KeyboardInterrupt will not show up directly
        when raised, but when the next controller event is registered. In case
        the program hangs on ``Ctrl+C``, just press or move any of the
        controller's buttons or axes.
        
        See the `API
        reference <https://github.com/linusg/xbox360controller/blob/master/docs/API.md#xbox360controller-parameters>`__
        for a more detailed explanation of the ``Xbox360Controller`` class and
        how to use all available buttons, axes and the hat.
        
        Rumbling
        ~~~~~~~~
        
        .. code:: python
        
            from xbox360controller import Xbox360Controller
        
            with Xbox360Controller() as controller:
                controller.set_rumble(0.5, 0.5, 1000)
        
        This will enable rumble on both sides of the controller with each 50%
        strength for one second (1000ms).
        
        LED
        ~~~
        
        .. code:: python
        
            import time
            from xbox360controller import Xbox360Controller
        
            with Xbox360Controller() as controller:
                controller.set_led(Xbox360Controller.LED_ROTATE)
                time.sleep(1)
                controller.set_led(Xbox360Controller.LED_OFF)
        
        This will let the LED circle rotate for one second and then turn it off.
        
        See the `API
        reference <https://github.com/linusg/xbox360controller/blob/master/docs/API.md#led>`__
        for all available LED modes.
        
        Debug information
        ~~~~~~~~~~~~~~~~~
        
        .. code:: python
        
            from xbox360controller import Xbox360Controller
        
            with Xbox360Controller() as controller:
                controller.info()
        
        Development/contributing
        ------------------------
        
        This project is still in its early days and I really appreciate all
        kinds of contributions - may it be new or improved code, documentation
        or just a simple typo fix. Just provide me a PR and I'll be happy to
        include your work!
        
        For feature requests, general questions or problems you face regarding
        this package please `open an
        issue <https://github.com/linusg/xbox360controller/issues/new>`__.
        
        Release History
        ---------------
        
        Please see
        ```CHANGES.md`` <https://github.com/linusg/xbox360controller/blob/master/CHANGES.md>`__
        for a complete release history.
        
        Authors
        -------
        
        -  Linus Groh (`**@linusg** <https://github.com/linusg/>`__) –
           mail@linusgroh.de
        
        License
        -------
        
        All the code and documentation are distributed under the MIT license.
        See
        ```LICENSE`` <https://github.com/linusg/xbox360controller/blob/master/LICENSE>`__
        for more information.
        
        .. |PyPI Version| image:: https://img.shields.io/pypi/v/xbox360controller.svg?style=flat-square
           :target: https://pypi.org/project/xbox360controller/
        .. |Build Status| image:: https://img.shields.io/travis/linusg/xbox360controller/master.svg?style=flat-square
           :target: https://travis-ci.org/linusg/xbox360controller
        .. |Code Health| image:: https://landscape.io/github/linusg/xbox360controller/master/landscape.svg?style=flat-square
           :target: https://landscape.io/github/linusg/xbox360controller
        
Keywords: xbox,xbox360,controller,gamepad,game,raspberry pi,event,led,rumble
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Games/Entertainment
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System
Classifier: Topic :: System :: Hardware
Classifier: Topic :: System :: Hardware :: Hardware Drivers
Classifier: Topic :: Utilities
