psychopy.org | Reference | Downloads | Github

Bug report: Keyboard Response event doesn't discard previous

OS (e.g. Win10): Mac OS 10.14.4
PsychoPy version (e.g. 1.84.x): 3.1.0
**Standard Standalone? (y)
**What are you trying to achieve?: Use keyboard response event to terminate a trial

**What did you try to make it work?:
The keyboard event is scheduled 5s into the trial to ensure subjects engage with the material before pressing SPACE

What specifically went wrong when you tried that?:
Pressing SPACE BEFORE the 5s is up still advances the trial.
Furthermore, repeatedly pressing space on one trial carries over into the next trial, i.e. the next trial then finishes after 5s (when the keyboard response event is scheduled), even when no key was pressed

Thanks @Marc_Buehner, looks like the clearEvents method is not clearing the event buffer. I will log an issue on GitHub to get this fixed. Are you running the developers version or standalone?

1 Like

HI there – sorry I forgot to reply. I am running standalone.
What’s the best way to manually clear the event buffer in the meantime until the bug is fixed?
I tried event.clearEvents() on every frame but that didn’t seem to do the trick

@Marc_Buehner, its fixed in 3.1.2.

1 Like

I’m having the same problem on Mac OS 10.14.4 and PsychoPy 3.1.5.
I’m calling the .clearEvents() function on my keyboard object but the buffer is not cleared. It seems, only calling .getKeys() effectively clears the buffer.