I am very new to coding and I have been set the task of creating a stroop test using code in psychopy.
The requirements are that I need to code for 1 trial of a modified stroop task experiment, using coder.
I have an initial frame of introduction, to explain to participants what they are expected to do, then they can start the experiment once they are ready by pressing any key.
I am stuck on the word ‘green’ coloured red appears on screen, till participants respond with a key response. Allowed keys are: r for red, g for green, b for blue and y for yellow. I then have an inter-trial interval. I have tried:
MyColor = random.choice([‘red’,‘blue’,‘green’,‘yellow’])
Phrase = random.choice([“red”,“green”, “blue”, “yellow”])
time = str(datetime.datetime.now())
key = str(event.getKeys(keyList=[‘r’,‘b’,‘g’,‘y’], ))
But this is not working. It is running through the words and word colours randomly without accepting the keys
- I am unable to record participants’ response and participants’ reaction time, it is saving something to a Test Output csv file but it doesn’t seem to have anything to do with my interaction with it.
I have really tried looking on the web and through books but I am really stuck on these points. Please help!
EDIT: I have changed getKeys to waitKeys and now it seems to accept some key input, not all the time though!? Which is strange So it just recording response and reaction times, if anyone could help with this I would greatly appreciate