In my experiment, I have 10 trials, and at each trial, the participant has to press a key (“space”) asap after seeing a change of colour in the animation. As feedback that confirms the key pressing, I’d like to move to the next trial (move to the next loop iteration) after the key was pressed. I tried to implement the idea in my code with
continue, but it doesn’t work:
for i in range(nTrials): # Start with fixation cross fixation.draw() win.flip() core.wait(2) # Play the video for 200 frames for Nframes in range(200): optic_flow_movie.draw() fixation.draw() win.flip() # Get Participants responses keys = psychopy.event.getKeys(keyList=["space"],timeStamped=clock) if (keys == 'space') is True: break else: continue # Take only the timestamps from the variable key and store it in the variable RTs RTs = [sublist[1:2] for sublist in keys] # This stores only the timestamps RTs = [item for sublist in RTs for item in sublist] # This converts from list of lists to a flat list
Many thanks for your help !