Hi,
I have a routine where the participant types freely to indicate the duration between two visual stimuli (i.e. before the “ms” in the screenshot below).
I use the code below in each frame to gather the user input in real-time:
L = event.getKeys();
if (L.length>0) {
if ((allowedKeys.some(r=> L.includes(r))==true)) {
userInput = userInput + L;
} else if ((L.includes('backspace')==true)&&(userInput.length>0)) {
userInput = userInput.substring(0,userInput.length-1);
}
}
Issue: For each trial, the user input from the previous trial will flash for ~1 frame (in front of the “ms”) and then disappear. For trial 1, it’ll flash “undefined”. I reset userInput to empty after each trial, but it doesn’t seem to help.
The problematic text component is as below:
I was wondering why I see that flash at the beginning of each trial.
You may try out the task and see the issue using the link: masking_p2 [PsychoPy]
I’d really your help with troubleshooting this issue.
Thanks.