psychopy.org | Reference | Downloads | Github

Mouse Response: Experiment exits on click

I’m trying to build an experiment with a mouse response. There are two text fields that are automatically generated from the excel list. People hear a sound and have to click on one of the words.

So far that works, but once I test the experiment and click on one of the words, it exits. I’ve tried pretty much all the settings there are for the mouse response, without success.

This is the error message that I get:

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

How can I get this to work?

I think this may be that you have entered some clickable stimuli into the mouse component, and one or more of those clickable stimuli are a string, rather than a clickable object.

I don’t really understand what that means. How do I turns my strings into clickable objects?

If you can tell me what you have entered as a clickable object in the mouse properties, we can see what is happening.

Here’s what it looks like now:


option1 and option2 are also the names of the columns in the .csv from which the options are loaded. Does that help or do you need more information?

Yes, thanks. option1 and option2 are strings, imported from your conditions file. You can change this to the actual text components option_1 and option_2 (text components are objects) and you should be able to click the text on screen .

I tried that, but now I get this error:

    mouse.clicked_option_1.append(obj.option_1)
AttributeError: 'TextStim' object has no attribute 'option_1'

:frowning:

That will be related to using ‘option_1’ in the store params field. You might instead want to store its name, so use name instead in the store params field, and the name of option_1 (or 2) will be stored.

Thanks! It seems to be working now! :slight_smile: