No response when the upper right corner X has been click

Hi everyone.
I am using PyschoPy to make a software now.I don’t want to let the PsychoPy fullscreen always and want to let it closed if I need.
But I can’t find the way to close the screen when I click the upper right corner.(fullscr = False the window has the (X) sign looks like can be click to close it.But in fact it not response.
Is there have some case can let me reference.

Sorry for my poor English.
Thanks.

Hi @July0508, I believe the close window functionality is disabled for experiments. If you build your experiment using PsychoPy Builder and ensure that “Enable Escape key” is selected in the experiment settings, then you should be able to quit your experiment using the escape key. If you are coding your experiment yourself, you can add your own escape key functionality:

from psychopy import core
from psychopy.hardware import keyboard

# create a default keyboard (e.g. to check for escape)
defaultKeyboard = keyboard.Keyboard()

# in your experiment loop check for quit (typically the Esc key)
if defaultKeyboard.getKeys(keyList=["escape"]):
    core.quit()

Thank you for your reply.
In fact I am hidding the right cornor (X) and make a prompt to tell the users to use the [Esc] to quit the program.
Also It have good users experience.

1 Like