View Single Post
  #2  
Old 08-21-2008, 10:57 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
If you want to control individual timers, then I recommend using the vizact library, specifically, the vizact.ontimer function. Here is some sample code that creates a simple timer and uses the keyboard to toggle it on/off:
Code:
import viz
viz.go()

def DoSomething():
	print viz.getFrameNumber()

#Create timer that calls 'DoSomething' every 1 second
mytimer = vizact.ontimer(1,DoSomething)


def ToggleTimer():
	mytimer.setEnabled(viz.TOGGLE)
	
#Toggle timer on/off when spacebar pressed
vizact.onkeydown(' ',ToggleTimer)
Reply With Quote