Thread: timer counter
View Single Post
  #3  
Old 06-13-2007, 02:35 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You need to declare the oldLocs variable as global. Your code should look like the following:
Code:
oldLocs = [ [0,0,0] for x in range(numLights) ] #Initialize to some value

def mytimer(num):
	global oldLocs 
	newLocs = []
	
	for x in range(numLights):
		
		newLoc = balls[x].get(viz.POSITION)
		newLocs.append(newLoc)
		
		viz.startlayer(viz.LINES)	
		viz.vertexcolor(1,0,1)
		viz.linewidth(1)
		
		#print 'newLocs[',x,']',newLocs[x]
		
		viz.vertex(newLoc)
		viz.vertex(0,0,0)
		
		tail = viz.endlayer()
		tails.append(tail)
			
		tail.size(0,0,0,1,viz.TIME)
		
	oldLocs = newLocs
Reply With Quote