psychopy.org | Reference | Downloads | Github

getKeys() returns empty list

im trying to implement event.getKeys() in a task i am building, but keep getting an empty list, without the keyboard input that was given. any ideas why?

At what point is the keyboard input given? The getKeys on line 10 in the screenshot will only (potentially) capture keypresses prior to, or at the time of, the window_control function being called.

1 Like

indeed, the function is being called (just didnt fit the screenshot), and the input is given while the window is opened (meaning - the function is operating)

If the keyboard responses are given while the function is operating, then the getKeys at the start will not be able to pick them up. If you move keys = event.getKeys() down to after line 32, say, you should be able to capture the keypresses.