Save Textbox input to a variable each frame

OS (e.g. Win10): Windows 10
PsychoPy version (e.g. 1.84.x): Latest (v2021.2.3)
What are you trying to achieve?: I want to collect Textbox component input on each frame of a routine, save the input to a variable using a code component, and then use this variable to update the text of a Text component on each frame.

What I’m imagining is that participants enter a number into the textbox, I run a calculation in the code component, and display the result of that calculation in a text component, and this all updates by frame.

What did you try to make it work?: I tried to save the input of the Textbox component to a variable in the code component, but I don’t know how exactly to write the code to save the textbox input to a variable. I figured it might be something like:

Each Frame
text_to_save = Textbox_component.text

But I don’t know what code to write that will perform this function, if this is possible at all!

Apologies if there is some obvious way to do this that I’m missing.

Thanks!

This is already a variable. There is no need to save it.

Ah, so it was even more obvious than i thought. Thanks!