To complete “Display a fixation point for 200 milliseconds.” I added a text component and changed its duration to 200 milliseconds to display a fixation point, but it resulted in an error. Why?
Create a Code component to control time. Ensure that this Code component is placed before the Text or Shape component to properly end the presentation of the fixation point.
In the ‘Begin Routine’ field of the Code component, create a Clock object and start it to time the presentation of the fixation point:
timer = core.Clock()
In the ‘Each Frame’ field of the Code component, check the time of the Clock object to determine when to end the presentation of the fixation point:
if timer.getTime() >= 0.2:
continueRoutine = False # End the presentation
In this example, the getTime() method of the Clock object returns the time elapsed since the timer was started (in seconds). When the elapsed time reaches 200 milliseconds, the condition timer.getTime() >= 0.2 becomes true, thereby ending the presentation.
The statement continueRoutine = False in this code snippet will result in the trial ending, allowing the experiment to continue with the next trial or step.
What was the error? What does your text component look like?