Textbox receiving input from previous trials routine

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2022.1.3
Standard Standalone? (y/n) If not then what?: Standard Standalone
What are you trying to achieve?:
I have 2 routines in the trial, the first has a textbox component to ask for text input from the participant. I’m detecting when they hit the Enter key to continue onto the next routine in the trial which has a keyboard response component to ask for a specific key response. However, when the experiment iterates onto the next trial, the response for the keyboard object in the previous trial appears in the textbox.

What did you try to make it work?:
I’ve tried explicitly setting the textbox text to blank, and calling textbox.reset in the Begin Routine section of a code component. My textbox component has its Text set to “set every repeat”

What specifically went wrong when you tried that?:
Neither of the above worked. I seem unable to prevent the response made to the keyboard object from appearing in the textbox on the next iteration.

Test experiment highlighting issue:
testTextbox.psyexp (16.9 KB)

Hello, I have the same problem as you. I was wondering if you were able to solve the problem? How to solve this problem?

It happens because the example shown forces the end of the routine on press.

It means the next loop starts before the participant has the time to release the key.
So what happens is the second routine starts, the button is released (after the routine already started!) and as a result of that, the pressed key is registered into the in Text Box :textbox:.

An easy fix would be changing the keyboard registration that forces the end of the routine to release:
image
You can still save the timestamp of the moment the key was pressed, for more precise data for reaction time measurement.

Another solution would be to restart the keyboard events at the start of the first routine/the end of the second routine.

2 Likes