Exit PsychoPy Window

I went through some PsychoPy code in the encoder view and ran the Window function:

http://www.psychopy.org/api/visual/window.html

This had a useful side effect when opening a gray window and did not bind any exit keys. How to get out of this situation? I am on a Mac running Snow Leopard.

I tried using Finder (Command + Space) to open a terminal window and type killall psychopy, but it was not effective. Maybe killall PsychoPy2it would be more efficient, but this is a rather unfortunate way to kill the error PsychoPy process - especially when you do not see if you opened the terminal window, and if you type. Is there a secret key combination that will always trigger PsychoPy on the screen?

+4
source share
4 answers

There is no magic click that will always work to close a window or exit a process. I highly recommend developing your experiment with fullscr = False, and then switching to fullscr = True in the final stages and to run items. (This switch is located in Builder> Experiment Settings> Screen> Full-screen window - uncheck the box or fullscr = False when creating a window instance in the code.) It is much easier to switch back and forth and close zombie windows if you are not in full-screen mode.

Builder "escape" , , - , Builder, "" , . ( Builder script !). , Experiment, , .

Coder, 2- , , , :

from psychopy import visual
w = visual.Window()

core.quit() - , script, (.. ).

, , PsychoPy, , , () - w1 :

from psychopy import visual
w1 = visual.Window()
w1.close()
# do other things here, perhaps a GUI
w2 = visual.Window()  # another, new window pops open

- , , . , .

+1

:

if 'escape' in event.waitKeys():
    core.quit()
+1

If you have a console open, you can kill everything that remains of your script, like this:

from psychopy import core
core.quit()

Alternatively, just close the hanging window:

from psychopy import visual
visual.Window.close()
+1
source

I often use this bit of code to get the key to exit the experiment in a non-blocking way:

while True:
        keys = event.getKeys()
        if keys:
            # q quits the experiment
            if keys[0] == 'q':
                core.quit()
0
source

All Articles