psychopy.org | Reference | Downloads | Github

Putting Text and Variable in a textbox

I am using the textbox function. I have a variable that changes called $Charity gain. I want to write in the textbox Change to $Charity gain. I want the text ‘change to’ to always be presented, but the charity gain variable to change (Which it does). Basically, I need help on how to add the words “Change to” to my textbook that has the variable $charity gain, because right now when I do it, it says syntax error.

$”Change to” + CharityGain

You can’t have a space in your variable name.

Thanks for your reply. When I try this I get this error:

must be str, not int

How can I fix this?
Thank you!

$”Change to” + str(CharityGain)

1 Like

Thanks! The issue I am running into is that there is no space between the change to and the variable I inputted. I even tried to add extra spaces after change to but no luck.

$"Change to " + str(CharityGain)