External_script

The external_script item is an alternative way of including Python code in your experiment. Whereas the inline_script allows you to enter Python code directly, the external_script item runs Python from a script file.

The following options are available:

Example

The following is an example of a script which displays a fixation dot for 1 second. The canvas is prepared in the prepare script and shown during the run script, to avoid timing issues.

import openexp.canvas

c = None

def prepare(item):

	global c
	c = openexp.canvas.canvas(item.experiment)
	c.fixdot()
	
def run(item):

	global c
	c.show()
	item.sleep(1000)