WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Check presence of joysticks ? (https://forum.worldviz.com/showthread.php?t=2728)

hotspur1 05-08-2010 06:36 AM

Check presence of joysticks ?
 
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 11:33 AM

The following code shows how to detect all the attached joysticks:
Code:

import vizjoy
joysticks = []
while True:
        joy = vizjoy.add()
        if joy.valid():
                joysticks.append(joy)
        else:
                break
print len(joysticks),'joysticks detected'



All times are GMT -7. The time now is 01:34 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC