I use the new Keyboard function from Psychtoolbox, and I usually clear the buffer just after starting the clock to measure response time:
resp = keyboard.Keyboard() #initialize keyboard #later in the experiment: stim.draw() win.flip() resp.clock.reset() resp.clearEvents(eventType='keyboard')
I just looked at the source code and noticed that the resp.getKeys() function (by default) clears anything that shows up in the buffer (after detecting it). This makes me wonder if I really need to call resp.clearEvents(eventType=‘keyboard’). Removing this call doesn’t seem to change anything. I am confused because the code generated by the builder also calls resp.clearEvents to clear the buffer when starting a clock. Could you please clarify?