WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 08-21-2014, 12:14 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
The following is a short example script that loops through 3 trials in a task function. Each trial loops for the number of images in the images list. For each image loop the program waits for either the 'y' or 'n' key to be pressed:

Code:
import viz
import viztask
import random

viz.go()

#Store images in list
images = []

def experiment():
	
	#Repeat trial 3 times
	for i in range(3):
	
		#Use random.shuffle to put images in random order
		random.shuffle(images)
		
		#Cycle through images
		for image in images:

			#display image
			
			#wait for 'y' or 'n' key to be pressed
			data = yield viztask.waitKeyDown(('y','n'))
			print data.key
			
			#remove image and let user know if response is correct
			
viztask.schedule( experiment() )
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
compiled exe won't save trials to AVI krimble Vizard 1 01-29-2014 11:32 AM
running experimental trials fivel_lab Vizard 3 03-18-2011 02:58 PM


All times are GMT -7. The time now is 04:43 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC