event.waitKeys() - Mouse click

Hi, I hope you are all doing well. I’m a newbie to psychopy, and I’m trying to create my first experiment - a visual search task.

The task is quite simple, 6 gratings will appear on screen simultaneously. 5 of them are of the same orientation and brightness, and 1 of them (target) has either a different orientation or grating than the rest of the gratings depending on conditions. And the user is suppose to click the target each trial. So far I’ve already created my 6 grating stimuli, but my question is, I want to display them until mouse click by the user. I know there’s the event.waitkey() function, but it doesn’t work with the mouse. So I’m wondering how can I do this?

Thank you very much for your help :slight_smile:

Hi,

In builder you can do that automatically by adding a mouse component and selecting ‘end routine’ on ‘valid click’:

If you are coding your experiment from scratch in coder, you want to use something like

while not mouse.isPressedIn(image_name):
   print(waiting)

Thanks,
Becca

PS. I don’t know if you are taking your experiment online, but since you mention that you are a psychopy newbie can I highlight that if you are coding your experiment from scratch in coder you won’t be able to take that online if you want to. Secondly, can I highlight a demo visual search task that you might find helpdul to build on and play with :slight_smile: https://gitlab.pavlovia.org/lpxrh6/visual-search (this works online and locally) hope this helps

2 Likes

Thank you Becca, that was really helpful!