Adjustable clickable stimuli in the Mouse component

This is a newbie question, so I hope someone can easily lend me a hand. I’m designing a practice trial for an experiment that presents two picture components (Left and Right). I want the participant to choose the correct answer from the two pictures, and if he doesn’t select the correct answer, that the program simply waits for him to correct the mistake and click the correct one.
Half of the trials have the correct picture on the left, half on the right. So, I set a Mouse component in the Routine to End the routine with a valid click, but want to customize the “Clickable stimuli” so that it only registers the correct response from an Excel table column called “correct_click”. I tried writing in the “Clickable stimuli” $correct_click and the same without the dollar sing, but it doesn’t register.
Can someone tell me how to customize the Clickable stimuli so that the program uses the name taken from the excel column “correct_click” and the Mousce component only registers that as a valid click?

Also, I forgot to add, the “correct_click” column has the names of the picture components, so either “Left” or “Right”

What version of PsychoPy are you using?

Potentially useful thread

However, this is even closer

1 Like

Thank you! Yes, the second question is really close to what I need, but I was unable to use the eval($correct_click) in the clickable stimuli box. To be more precise, it starts the experiment, but when it gets to that routine, and I click (either the correct or the incorrect image) it gives this message:

for obj in eval(correct_click):
TypeError: 'ImageStim' object is not iterable
##### Experiment ended. #####

I tried the recommended code to stop the routine from the same thread and a similar problem happens.

To answer your first question, I’ve used an older version from two years ago, I’m using the latest version (v2021.1.4).

Update: that imagestim object is not iterable message has become a pervasive problem in my experiment (After updating my PsychoPy to the latest (v2021.1.4), my experiment crashes), so I’m not sure if it’s related to this topic.

Try adding a comma after eval(correct_click) so that PsychoPy interprets it as a list.

Doesn’t work. Gives this error (V1_mis is the name of the mouse component):

if obj.contains(V1_mis):
AttributeError: 'str' object has no attribute 'contains'

EDIT: removed the quotes from the excel table (it’s left/right instead of “left”/“right”), and now the error message is:

for obj in eval(correct_click),:
  File "<string>", line 1, in <module>
NameError: name 'right' is not defined

Isn’t your component called Right not right?

Thank you! That fixed the problem :smiley: