| Reference | Downloads | Github

'\$' solution for text with dollar signs no longer works on Builder


I am running a decision making task I created with Builder several months ago, which contains text components that display monetary values with a preceding dollar sign. When creating this task on Builder, I used ‘backslash$’ before the monetary values so that the text displays properly (e.g. ‘You have $24’). Now that I’ve updated Psychopy, that solution no longer works and now the backslash is also being written into the text when the task is run (e.g. ‘You have $24’). This is odd because using ‘$’ returns no error in the component box.

Any insight on this would be greatly appreciated. Thank you so much in advance!


Have you tried just removing the ?

Does that give an error?

You could get round it by setting a variable (e.g. $msg) in code.

Removing the backslash does return an error, but setting a variable worked! Thanks so much.

could you walk through how to set a variable?

In a code component, e.g. Begin Routine

msg = "The amount was $"+amount

Then use $msg as the text set every routine in a text component that is below the code component in the same routine.

What about if I need it in a textbox with a consent form where I can’t use $msg because there are many other words in the textbox?

Have you tried?

Use \n for new lines.