View Single Post
  #2  
Old 04-09-2009, 11:03 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,466
You could try this to keep only one timer active at a time.
Code:
import viz
viz.go()

def calculate():
      print 'calculate'  

def speed():
      print 'speed'

timer1 = vizact.ontimer2(1,viz.FOREVER,calculate)
timer2 = vizact.ontimer2(1,viz.FOREVER,speed)
timer1.setEnabled(viz.OFF)
timer2.setEnabled(viz.OFF)

def funcA():
  
  timer1.setEnabled(viz.ON)
  timer2.setEnabled(viz.OFF)

vizact.onkeydown('a',funcA)


def funcB():
  
  timer1.setEnabled(viz.OFF)
  timer2.setEnabled(viz.ON)
  
vizact.onkeydown('b',funcB)
Reply With Quote