Skip to main content

Gamepad Mapping

import pygame
from gamepad_mapper import load_or_map, read_gamepad

pygame.init()
pygame.joystick.init()
assert pygame.joystick.get_count() > 0, "No game controller found."

joystick = pygame.joystick.Joystick(0)
joystick.init()
mapping = load_or_map(joystick, ["Roll", "Pitch", "Throttle", "Yaw"], ["arm"], force=True, name="example")
axes, buttons = read_gamepad(joystick, mapping)
print(axes)
print(buttons)

Output

{'Roll': 0.796051025390625, 'Pitch': 0.62353515625, 'Throttle': -0.17645263671875, 'Yaw': -0.741180419921875}
{'arm': 1}

Metadata

Release files for gamepad-mapper 0.0.5

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

Source distribution (sdist)

Source distribution for gamepad-mapper 0.0.5
File Size Uploaded
gamepad_mapper-0.0.5.tar.gz 3.0 kB Details

Release files / gamepad_mapper-0.0.5.tar.gz

Download URL gamepad_mapper-0.0.5.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
31dfe23636ef1d46bdc36e2139c422ca9d7ddb44f458b6e5b5235de103da21a7
BLAKE2b-256 checksum
How to use checksums
edcb41cf660f4280064156dd8df1921154a471d12408e56cf89151ffa1fff06f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.5 This release

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

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