psychopy.org | Reference | Downloads | Github

Clickable exit button on window

Hi everyone
I’m trying to create a button(clickable image) on my window. I want to show this button in every frame of my experiment , if the subject clicks on it at any point, the experiment will shut down.
Any idea on how to do this?

Thanks for your help!

We’re working on a dedicated Button Component which will allow you to do this, but this is a work in progress, unfortunately. While you wait, you can use an Image and Mouse as a stand-in! Essentially just create an Image component and a Mouse component, then set “clickable stimuli” for the Mouse component to be the name of your Image component. Then use a code component to execute core.quit() if the Mouse component is clicked on the Image component.

1 Like

Dear @TParsons
Thank you for your reply and good suggestion. However, I’m still not clear on how to create a mouse component. Could you maybe help me with this?

Hi Dara,

You can add a Mouse component the same way as any other component - using the menu on the right hand side. The icon should look like this:
mouse@2x

Dear Todd, as I mentioned earlier I am building my experiment from scratch using python scripts