[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] pyGame - Logitech rumble pad input OS X (10.3.9)
Hi,
I apologize if this has been sent multiple times. I sent a message before
confirming joining the list, and am unsure if it was posted.
I am having some difficulty getting an event loop to poll a Logitech
RumblePad2. I think that I am missing a trivial step in polling the event
queue for a joystick button press, and was hoping someone could help me out
on this list.
I have attached some basic code that used to work for keyboard input. I
added an init function for the joystick and am trying to get the
JOYBUTTONDOWN event to be recognized and poll for the button that has been
pressed. I do not need to have the axis directions or the hat functions
used at all, simply need to poll for 1 of the 12 buttons being pressed as
well as which button is was.
The versions I have installed of various libraries (most important pygame)
is:
Version checklist:
Python version 2.3 (OK)
extra Python info: (#1, Sep 13 2003, 00:49:11) [GCC 3.3 20030304 (Apple
Computer, Inc. build 1495)]
Numeric version 24.0b1 (OK)
PyOpenGL (package "OpenGL") version 2.0.2.01 (OK)
pygame version 1.7.0 (OK)
Python Imaging Library (package "Image") version 1.1.5 (OK)
All of this is running on OS X (10.3.9) using the USB overdrive drivers for
the RumblePad2.
Any help is greatly appreciated.
Cheers,
Kjm
import pygame
import pygame.joystick
from pygame.locals import *
import sys
def init_pygame():
'''Initialize pygame. Here is where you will stick window dimensions
etc.'''
pygame.display.init()
joystick = None
def init_joy():
"initialize a joystick object"
global joystick
try:
num = pygame.joystick.get_count()
if num>0:
joystick = pygame.joystick.Joystick(0)
joystick.init()
elif num == 0:
print "No joystick detected"
sys.exit()
except pygame.error:
joystick = None
print "No joystick detected"
def main():
init_pygame()
init_joy()
done = False
while not done:
event = pygame.event.pump()
print event
if event.type == JOYBUTTONDOWN:
print "here!"
done = True
if __name__ == "__main__":
main()