19 lines
396 B
Python
Executable File
19 lines
396 B
Python
Executable File
import pygame
|
|
|
|
pygame.init()
|
|
pygame.joystick.init()
|
|
|
|
joystick = pygame.joystick.Joystick(0)
|
|
joystick.init()
|
|
|
|
print(f"Control detectado: {joystick.get_name()}")
|
|
print("Presiona botones, Ctrl+C para salir.")
|
|
|
|
while True:
|
|
pygame.event.pump()
|
|
for i in range(joystick.get_numbuttons()):
|
|
if joystick.get_button(i):
|
|
print(f"Botón {i} presionado")
|
|
pygame.time.wait(100)
|
|
|