OS (e.g. Win10): Win 10
PsychoPy version (e.g. 1.84.x): 3
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?: Participants should learn new words. After some training I want to check whether they remember the definition to the newly learned word. For that I want to put the target in the middle of the screen and put two definitions on the bottom left and right of the screen. One defintion should be corresponding to the target, one should be a definition of another word (so that it’s not recognition but matching).
What did you try to make it work?: I tried to use a code component looking like this (txt file including all definitions):
with open(‘definitions.txt’) as file: definitions = file.read().splitlines()
current_definition = definitions.pop()
In the routine I put a text component including $word from my conditions’ excel file, a text component including $current_definition and a text component including $definition
What specifically went wrong when you tried that?: The loop does not start + I know, that I do not have a link to the target so that none of the two definitions displayed will possibly be fitting to the target. However, with my little psychopy knowledge I do not know how to resolve this problem. Thankful for any help!
P.S.: I would also like to randomize where the correct definition will be displayed (bottom left or bottom right). I tried using the code explained here: Randomization of stimuli positions - Builder - PsychoPy but it didn’t work for me…
I’m not entirely sure about what is not working in your code component.
My suggestion is to don’t use a code component! It seems to be that anything you want to do can be achieved inside the builder:
- You can create an excel file for the looping, containing the two definition in each row and just set the loop to randomise
- Then you can have two text box on the screen that display the two definition
- For the participants response you can have a keyboard component (e.g. lelf and right arrow) , OR you can have a mouse response by placing two invisible polygons behind the text responde and having the participant click on the right answer
Thank you for your reply!
However, I need to display the target word to which the correct definition should be chosen. So if I have an excel sheet I need to have a parameter with the target word and one with the correct definition and one with a not fitting definition which should be randomized across participants. I don’t really see how I can manage this without a code…
So I found a solution for the problem in the post scriptum but I still do not know how to solve the problem of showing the fitting definition to the target and displaying a randomised distractor definition of my list of definitions.
This is doable The way conditions files work is that, each iteration of the loop, PsychoPy chooses a row of the table and creates a variable for each column. So let’s say your table was:
||thing to sit on
||eight legged insect
||surface to eat off
||common household pet
you would set the value of the textbox containing your target word to be
$targetWord, the value for the correct definition to be
$correctDef and the value for the incorrect definition to be
$incorrectDef, then set all of these values to
Set each repeat.