View Single Post
  #2  
Old 01-13-2009, 04:32 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Yes, each call to vizjoy.add() will return the next available joystick. Here is a sample script that shows how to connect to multiple joysticks:
Code:
import viz
import vizjoy
viz.go()

joy1 = vizjoy.add()
joy2 = vizjoy.add()

def joydown(e):
	if e.joy == joy1:
		print 'Joystick 1 button',e.button,'pressed'
	elif e.joy == joy2:
		print 'Joystick 2 button',e.button,'pressed'
	
viz.callback(vizjoy.BUTTONDOWN_EVENT,joydown)
Reply With Quote