View Single Post
  #3  
Old 07-05-2019, 12:14 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,462
Try using a task function to control the program flow. For example:

Code:
'''
Press spacebar to start
'''

import viz
import vizinfo
import viztask

viz.go()
vizinfo.InfoPanel()

dojo = viz.addChild('dojo.osgb')

cue = viz.addChild('soccerball.osgb',pos=[0,1.8,2])
cue.visible(viz.OFF)
stim = viz.addChild('basketball.osgb',pos=[0,1.8,2])
stim.visible(viz.OFF)

def experimentTask():
	yield viztask.waitKeyDown(' ')
	cue.visible(viz.ON)
	yield viztask.waitTime(0.5)
	cue.visible(viz.OFF)
	yield viztask.waitTime(0.65)
	stim.visible(viz.ON)
	yield viztask.waitTime(0.5)
	stim.visible(viz.OFF)
	
viztask.schedule( experimentTask() )
Reply With Quote