Change default Escape function to stop/end the experiment immediately
How can I change the default escape key function of pause/resume to stopping/quitting the experiment immediately?
Many thanks
How can I change the default escape key function of pause/resume to stopping/quitting the experiment immediately?
Many thanks
Comments
Hi @Carlosvandango ,
Escape should not immediately stop the experiment. Instead, it will ask for confirmation by a 'q' press, right? I guess it will be tricky/ near impossible to change the function of the
Escbutton...Am I right, @sebastiaan ?
Cheers,
Lotje
Did you like my answer? Feel free to

See also here:
Did you like my answer? Feel free to

Hi @lvanderlinden
Yes the escape key does currently pause the experiment and asks for a 'q' key press to confirm, but that is not what I want.
I would like by pressing the escape key the experiment quits/stops immediately.
I saw in another post, that it is possible to make changes to the exp.pause () function such as:
def my_custom_pause_function(): print('I don\'t do anything right now, but I could!') exp.pause = my_custom_pause_functionHi @Carlosvandango ,
If you add some code to
my_custom_pause_function()that causes a crash, then OpenSesame will stop when you press Escape. This can be anything, but the most elegant solution is to raise an informativeException, like so:def my_custom_pause_function(): raise Exception('The escape key was pressed!') exp.pause = my_custom_pause_functionSee also:
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Great. Thanks Sebastiaan and Lotje for your help.