Hello everyone,
I’m doing an online experiment where people hear words and then have to type them. I have some custom code that interprets their response into a string called refined_response
and presents it back to them as they type. It then parses the response to see how many words were typed correctly. Here’s the python code:
L = event.getKeys()
if len(L):
if 'escape' in L and isPyExp:
core.quit()
else:
for i in L:
if i in allowedKeys:
refined_response = refined_response + i
elif i == 'space' and len(refined_response)>0:
refined_response = refined_response + ' '
elif i == 'backspace' and len(refined_response)>0:
refined_response = refined_response[:-1]
Locally, the code seems to work fine, and the experiment also runs online, except that at the beginning of some trials, the typed response from the previous trial will flash briefly before the recall period begins. This could be distracting to people trying to hold the current words in memory.
I have tried to clear the responses both at the beginning of the recall routine and after logging the response by inserting this code:
PY:
# flush typed words so they don't appear later
clearEvents()
refined_response = ""
JS:
// flush typed words so they don't appear later
psychoJS.eventManager.clearEvents();
refined_response = "";
But the problem still remains. I should note that I’m using PsychoPy 2020.2.4, so the bug fix implemented here by @dvbridges should be incorporated, I think.
Any idea what’s going on? Am I just using the wrong commands to flush, or is this something more fundamental?