Starting a video once mouse is clicked within Affect Grid

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): MacOS Monterey 12.5
PsychoPy version (e.g. 1.84.x): 2021.2.3
What are you trying to achieve?:
I’m using @wakecarter 's Affect Grid to collect continuous ratings while a video is playing. I’m hoping to have the video begin once participants have clicked within the grid, so they can get their bearings on where in the grid they are located (I would prefer if they could begin at the origin but realize this isn’t possible since it isn’t an open square in the center). I’m pretty new to PsychoPy and Python so I apologize that this is a pretty basic question!

What did you try to make it work?:
Created a mouse component named mouse_Ready, have been trying to change the video stimuli to begin conditionally with mouse_Ready.isPressedIn(x) but am not sure what to put in for ‘x’. I’ve tried “grid,” but since the grid is a code component I’m not sure what to put. Would it be just the coordinates of a general area of the grid?

What specifically went wrong when you tried that?:
“…exp_lastrun.py”, line 785, in
if movies.status == NOT_STARTED and mouse_Ready.isPressedIn(grid):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/event.py”, line 882, in isPressedIn
return any(wanted & pressed) and shape.contains(self)
AttributeError: ‘list’ object has no attribute ‘contains’

Thank you for any help you can provide!!

Hi @jsimonson,

the grid consists of multiple shapes and is not “one thing” (as far as I can see, I can’t run the experiment). So you could check for every single shape in the grid. But what would be simpler is adding a transparent rectangle covering the whole grid and checking whether the mouse was clicked in that one.

Hope that helps!

2 Likes

Instead of using pressed in, you could check the values set by the grid. Also the grid could be changed to have an odd number of scale points if you want a central point to be selectable.

1 Like

Thank you so much for the advice! Do you know what I would put as the condition for checking whether the mouse was clicked within the rectangle?

Thank you! What would be the code for checking the values set by the grid? I was able to get the grid cursor to begin at center, but once the mouse is moved it goes to the closest point.

You can use exactly the code you posted first, but replace „grid“ with the name of the rectangle.

Oh yes that worked, thank you!! This is my first PsychoPy experiment so I keep forgetting what I have tried and haven’t tried. Thank you for your help!

1 Like