OS (e.g. Win10): Mac 12.2.1 PsychoPy version (e.g. 1.84.x): 2022.2.4 Standard Standalone? (y/n) If not then what?: yes
I want to record responses using a textbox, but the last button response from the previous routine is recorded in the text box, despite not pressing a button during the trial that contained the textbox.
Previous posts suggested I set the textbox to editable and “set every repeat”, add textbox.text = "" to the Begin Routine tab of a code component, or change the order of the components within the routine, but these suggestions did not fix the issue. Pictures are attached below in case they help.
In case it helps, I added a routine with a text component set for 100 ms before the routine that contained the textbox component and that seemed to resolve the issue.
I had the same problem, using PsychoPy v2021.2.3. When a routine containing an editable textbox followed a routine that elicited a keyboard response, the keyboard response was displayed in the textbox. It was not sufficient to add a code component with
myTextbox.text = ""
in the ‘Begin Routine’ tab because the textbox read responses from the keyboard buffer after the execution of this code. What worked for me was to clear the textbox again during the first few frames of the routine.
When the textbox is within a Form component, rather than being a freestanding Textbox component, I found that I could access it using the following code, where my textbox was the second item listed in the Form component’s spreadsheet, so its item number starting at zero was 1.