basic usage of joysticks

This is an extremely short script that takes input from a joystick and prints it to the console. Requires Pygame. This is a work in progress. Next up is printing the results inside a Panda window.

http://home.earthlink.net/~lvraab/joystick1.py

Would you be so kind as to correct the link or post the code as text here? I am very interested … Thx!

Found this … works excellent :

#Capturing input data from a joystick using Pygame

#Import pygame and init
from pygame import *
init()

#Setup and init joystick
j=joystick.Joystick(0)
j.init()

#Check init status
if j.get_init() == 1: print "Joystick is initialized"

#Get and print joystick ID
print "Joystick ID: ", j.get_id()

#Get and print joystick name
print "Joystick Name: ", j.get_name()

#Get and print number of axes
print "No. of axes: ", j.get_numaxes()

#Get and print number of trackballs
print "No. of trackballs: ", j.get_numballs()

#Get and print number of buttons
print "No. of buttons: ", j.get_numbuttons()

#Get and print number of hat controls
print "No. of hat controls: ", j.get_numhats()

#Setup event information and print data from joystick
while 1:
    for e in event.get():
        if e.type != QUIT:
            print '%s: %s' % (event.event_name(e.type), e.dict)

I should mention - the latest version of panda, 1.3.0, sets the registry key that locates the python install directory. This, in turn, makes it easy to install python add-ons like pygame and the like.