PDA

View Full Version : Check presence of joysticks ?


hotspur1
05-08-2010, 05:36 AM
Is there a way to check if any USB joysticks are plugged into the computer?

It seems when vizjoy is imported, it checks for joysticks since I get a message on the output panel NOTIFY: 0 joysticks found.

Is there a way to intercept this notification?

Thanks in advance

farshizzo
05-18-2010, 10:33 AM
The following code shows how to detect all the attached joysticks:import vizjoy
joysticks = []
while True:
joy = vizjoy.add()
if joy.valid():
joysticks.append(joy)
else:
break
print len(joysticks),'joysticks detected'