[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] gamepad problem on osx
- To: pygame-users@xxxxxxxx
- Subject: [pygame] gamepad problem on osx
- From: altern <altern2@xxxxxxxxx>
- Date: Tue, 07 Mar 2006 16:17:52 +0100
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Wed, 08 Mar 2006 10:17:54 -0500
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; b=ReaSLAGCIo1/GlqemWiE0ehFw1Nex7HsuOPICpjOSYAQ3PQIQ4ygEfhcXN5Vkk6cYsl1sW2eE/8TBQGFsqwrYiGl6OpMnZdyXtY7Nt4xEY7HE9EtVjNsiGEvWJ8IHQmnJ40K7XJj5yfKrJD6lJ4mDuw63Ma+MCfI6d122lYaaTU=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: Mozilla Thunderbird 1.5 (X11/20051201)
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