import pygame from pygame.locals import * pygame.init() pygame.joystick.init() print pygame.joystick.get_count() j = pygame.joystick.Joystick(1) j.init() print j.get_name() print j.get_numaxes() print j.get_numbuttons() print j.get_init() axes = "" buttons = "" i=0 while (True): for event in pygame.event.get(): if event.type == QUIT: break for i in range(0, j.get_numaxes()): if (j.get_axis(i) != 0 and False): print "Axis %d moved" % i for i in range(0, j.get_numbuttons()): if (j.get_button(i)): print "Button %d" % i #for i in range(0, j.get_numaxes()): # axes += " " + str(j.get_axis(i)) #for i in range(0,j.get_numbuttons()): # buttons += " " + str(j.get_button(i)) #print axes + " " + buttons