psychopy.org | Reference | Downloads | Github

Mouse attribute error

Using
Win 10 PsychoPy v.1 90.2 standalone

I’m trying to set up a mouse click response for a screen with 3 image options, on which participants have to select one by clicking on the mouse

I tried to use the response option mouse, but i didn’t really understand how to complete the last two parametres: clickable stimuli$ (do I complete with one of the headers of my stimuli list in excel; and if so, with or without the dollar sign?), store parameters for clicked dollar sign: ? )

Also, when I tried to run the experiment, I got an error message, and the experiment was terminated before running all of it:

in
if obj.contains(mouse):
AttributeError: ‘unicode’ object has no attribute ‘contains’

I tried generating a script and substituting contains for find. That did not fix it, but, sincerly, I understand little of coding.

Any help would be greatly appreciated.
Thank you!

Marije

Hi Marije, I think the issue here is that you are using variable names from your conditions file in the “clickable stimuli” field. That field needs to contain the names of your actual stimulus components (i.e. your 3 image components). Those image components will then be checked to see if a mouse click has occurred in them.

At the moment, it seems like you are using a variable from your conditions file, which just contain a string of characters. A string of characters (represented as Unicode text) isn’t a stimulus that exists on screen and hence can’t have a contains() function to see if it has been clicked in.

The “store parameters” setting is how you know what stimulus was clicked. It probably defaults to name, which tells you the name of the component that was clicked (e.g. image_1). That may or may not be sufficient for you to judge if the response was correct. e.g. it might be useful for you to add image, which will give the name of the file being displayed by that component (e.g. dog.png).

No, you don’t need to use a $ prefix: the presence of the $ in the field label tells you that this field will automatically be interpreted as code, rather than literal values.

1 Like

Yep! Did the trick.
Thank you so much for taking the time to explain.

Best, Marije