first commit
This commit is contained in:
18
pyprojs/xbox-buttons-test.py
Executable file
18
pyprojs/xbox-buttons-test.py
Executable file
@@ -0,0 +1,18 @@
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user