blob: a8ed6f1dcb3273d9dfeef4a89da5f79316e49eff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/usr/bin/python3
import pygame
pygame.display.init()
pygame.joystick.init()
print ("Joystics: ", pygame.joystick.get_count())
my_joystick = pygame.joystick.Joystick(0)
my_joystick.init()
clock = pygame.time.Clock()
print (my_joystick.get_numbuttons())
print (my_joystick.get_numhats())
while 1:
for event in pygame.event.get():
print (my_joystick.get_axis(0), my_joystick.get_axis(1))
for i in range(my_joystick.get_numbuttons()):
print(i, my_joystick.get_button(i))
clock.tick(40)
pygame.quit ()
|