Global event keys won't work in coder (even trying to run just the example from the psychopy website)

Hi all,

I have written several experiments in Coder, and am trying to add a global shutdown key rather than having to add lines listening for ‘escape’ keypresses at every step of the experiment.

The website seems to indicate that this is an option in coder in addition to builder, based on the fact that the coder info page has a large section of links to the global event keys page.

However, none of the examples or how-to’s have worked in my code. So I tried directly running just the “Working Example” at the bottom of the global event keys page on its own, and even that didn’t work. It was registering the keypresses in the console output as follows:

For the “change color” keypress (c):

Changed color to [0.00392157 0.00392157 0.00392157]

(however there was no color change)

For the shutdown keypresses (ctrl + q):

Exception ignored on calling ctypes callback function: <function Win32Window.get_window_proc..f at 0x00000214AEFB5790>
Traceback (most recent call last):
File "C:\Program Files\PsychoPy\lib\site-packages\pyglet\window\win32_init
.py", line 665, in f
result = event_handler(msg, wParam, lParam)
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\window\”, line 736, in event_key
self.dispatch_event(ev, symbol, modifiers)
File "C:\Program Files\PsychoPy\lib\site-packages\pyglet\window_init
.py", line 1330, in dispatch_event
if EventDispatcher.dispatch_event(self, *args) != False:
File “C:\Program Files\PsychoPy\lib\site-packages\pyglet\”, line 425, in dispatch_event
if getattr(self, event_type)(*args):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\backends\”, line 434, in onKey
event._onPygletKey(evt, modifiers)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\”, line 233, in _onPygletKey
_process_global_event_key(thisKey, modifiers)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\”, line 254, in _process_global_event_key
r = event.func(*event.func_args, **event.func_kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\”, line 88, in quit
sys.exit(0) # quits the python session entirely
SystemExit: 0

(And it did not shut down)

Any help on this would be very much appreciated!