hi
I am using pygame to get info from a gamepad (logitech dual
action usb). The script is really simple and it runs fine on my
debian desktop but it gets kind of blocked on my G3 500mhz iBook.
It prints some data with the intialisation values and no matter
how many buttons i press it doesnt change. However when i type in
the keyboard it does print the keyboard event, so the script is
not frozen, it just looks like it doesnt get anything from the
gamepad.
Anyone has any idea why this could be happening?
This is the code, nothing fancy about it
thanks!
#!/usr/local/bin/python2.3
import pygame
import pygame.event
from pygame.locals import *
try: # joystick
pygame.joystick.init() # init main joystick device system
for n in range(pygame.joystick.get_count()): #
stick = pygame.joystick.Joystick(n)
stick.init() # init instance
# report joystick charateristics #
print '-'*20
print 'Enabled joystick: ' + stick.get_name()
print 'it has the following devices :'
print '--> buttons : '+ str(stick.get_numbuttons())
print '--> balls : '+ str(stick.get_numballs())
print '--> axes : '+ str(stick.get_numaxes())
print '--> hats : '+ str(stick.get_numhats())
print '-'*20
except pygame.error:
print 'no joystick found.'
def main():
pygame.init()
clock = pygame.time.Clock()
while 1 : clock.tick(20) for
e in pygame.event.get(): print e # PRINT all events
if __name__ == '__main__': main()
--
enrike