Metadata-Version: 2.4
Name: robot-xbox-joystick
Version: 0.0.6
Summary: Library for basic xbox joystick controllers.
Project-URL: Documentation, https://github.com/fmorton/robot-python-xbox-joystick#readme
Project-URL: Issues, https://github.com/fmorton/robot-python-xbox-joystick/issues
Project-URL: Source, https://github.com/fmorton/robot-python-xbox-joystick
Author-email: Frank Morton <fmorton@mac.com>
License-Expression: LGPL-3.0-only
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.9
Requires-Dist: pygame
Provides-Extra: dev
Requires-Dist: black; extra == 'dev'
Requires-Dist: flake8; extra == 'dev'
Requires-Dist: pylint; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-mock; extra == 'dev'
Provides-Extra: test
Requires-Dist: flake8-pyproject; extra == 'test'
Requires-Dist: pytest-cov; extra == 'test'
Requires-Dist: pytest-mock; extra == 'test'
Requires-Dist: pytest>=8.3; extra == 'test'
Description-Content-Type: text/x-rst

========
Overview
========

.. start-badges

.. list-table::
    :stub-columns: 1

    * - docs
      - |docs|
    * - package
      - | |version| |wheel| |supported-versions|
.. |docs| image:: https://readthedocs.org/projects/robot-python-xbox-joystick/badge/?style=flat
    :target: https://robot-xbox-joystick.readthedocs.io/
    :alt: Documentation Status

.. |github-actions| image:: https://github.com/fmorton/robot-python-xbox-joystick/actions/workflows/github-actions.yml/badge.svg
    :alt: GitHub Actions Build Status
    :target: https://github.com/fmorton/robot-xbox-joystick/actions

.. |requires| image:: https://requires.io/github/fmorton/robot-xbox-joystick/requirements.svg?branch=main
    :alt: Requirements Status
    :target: https://requires.io/github/fmorton/robot-xbox-joystick/requirements/?branch=main

.. |codecov| image:: https://codecov.io/gh/fmorton/robot-xbox-joystick/branch/main/graphs/badge.svg?branch=main
    :alt: Coverage Status
    :target: https://codecov.io/github/fmorton/robot-xbox-joystick

.. |version| image:: https://img.shields.io/pypi/v/robot-xbox-joystick.svg
    :alt: PyPI Package latest release
    :target: https://pypi.org/project/robot-xbox-joystick

.. |wheel| image:: https://img.shields.io/pypi/wheel/robot-xbox-joystick.svg
    :alt: PyPI Wheel
    :target: https://pypi.org/project/robot-xbox-joystick

.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/robot-xbox-joystick.svg
    :alt: Supported versions
    :target: https://pypi.org/project/robot-xbox-joystick

.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/robot-xbox-joystick.svg
    :alt: Supported implementations
    :target: https://pypi.org/project/robot-xbox-joystick


.. end-badges

Library for basic xbox joystick controllers.

* Free software: MIT License

Installation
============

::

    pip install robot-xbox-joystick

You can also install the in-development version with::

    pip install https://github.com/fmorton/robot-xbox-joystick/archive/main.zip



Xbox Joystick Example
=====================

.. code-block:: python

    import pygame
    import pytest

    from robot.xbox_joystick import XboxJoystick

    joystick = XboxJoystick().connect()

    print("Joystick connected")

    running = True

    while running:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
            elif event.type == pygame.JOYBUTTONDOWN:
                print(f"Button {event.button} pressed on joystick {event.joy}")

                if event.button == 2:  # 'X' button to quit
                    running = False
            elif event.type == pygame.JOYAXISMOTION:
                print(f"Joystick axis {event.axis} value {event.value}")



Testing
=======

To run all the tests run::

    pytest -s
