Textbox (and textbox.text output) includes carry over string from other components/routines

OS: Win10
PsychoPy version: 2021.1.2
Standard Standalone? (y/n) Y

Hi, trying the new amazing textbox component. It seems to work as I wanted, i.e., participant enters a short text there (editable). However, in the output .csv file, the textbox.text column includes some contents of the keyboard responses from the previous routines/key_resp components (e.g., if previous routine requires pressing ENTER in order to terminate, then an empty line would appear in the next routine in the textbox component). Has this been addressed somewhere?

Thank you!

Just to be clear, is this only for when a key is still held down when the next routine starts? For example, if you type a bunch of characters in one textbox, those characters aren’t then all recorded for the next one?

I think we may be able to fix that, but I’d have to check - it would probably be something like what we do for Mouse and Button where we can check whether a button press is a new press, so only new keypresses are registered.

Here is the flow: the trial (routine) ends by a keypress, if it is “return”, then the textbox in the subsequent routine (Text) would (sometimes) have first line empty (as if u pressed enter). Or, if it is a letter, then the routine’s textbox element starts with this letter filled in. Sometimes it seems that the empty lines / spaces are accumulating, but I did not have time to check it in a systematic way. Anyway, I resolved this temporarily by requiring “tab” keypress to end the routine (i.e., for transitions). Since “tab” does not fill in any “content”, there is no “carry over” (except the fact that sometimes there is additional empty space, " ", in the text, though). Thank you for checking this out. Best, M.

Ah yes that makes sense - it’s probably that the keypress continues into the first frame of the next routine, so the Textbox is picking it up as a new press. I’ll look into adding something at the start routine code for TextBox to make sure it only accepts new presses. Thanks for catching this!

1 Like

I’m having the same issue (sorry if we don’t like “bumping” threads here, but this was a recent thread and the same concern).

I want participants to type their answer into a textbox and hit “return” to submit. I haven’t run into any issues where their answer carried over (they’re not responding that quickly) but the “return” does, causing the location of the textbox input to jump around.

These didn’t work, but what I tried was:

  • Briefly delaying the start of the textbox stimulus
  • Adding a code for “Begin routine” to set textbox.text it to " "

Beyond those, I’m not sure how to tell it to only accept new presses. It’s not a huge deal, but it’s a little distracting and maybe a concern when working across different hardware. Thank you for your advice!


Do you mind posting the specific code you had used to fix this error? I am struggling a bit with inputting your proposed solutions…Thank you in advance :slight_smile:

I had the same problem and I am using an easy workaround.
You can insert a single line of code like:

GetMailString.text =""
at the beginning of the routinne,
where “GetMailString” is the name of my textbox component.

I have a request ( not sure where else to put it ).

The “editable” is easy to overlook for people that only get into PsychoPy occasionally.
Personally I would prefer if the checkbox is replaced with a drop-down on the right ( where all drop-downs are ) just saying “editable” “constant” as options.

I think editable will work with both constant and each repeat but I agree than it might make sense to have it in the constant/each repeat/each frame dropdown to clarify what combinations are sensible.

What do you think @TParsons ?

Thanks wakecarter,
my desire is to make it larger and in line with the other options.
The “Constant” I used intended to say “not editable” :-), not about the specific wording.