How do I display a $ char within text in a Text Component?

**OSX 10.12.6
**PsychoPy v2021.2.3
**Standard Standalone

I want to display several lines of text on a page - including using a $ char in the middle of lines within a Text component. Eg:

A bat and a ball together cost S1.10.

I have tried various approaches as suggested in multiple threads/posts on this forum such as using
+String.fromCharCode(36)
and ‘$’

But neither approaches works in the context of a single character within plain text of the component.

I have also tried creating a string in code and referring to this - but can’t figure out how to get this on one line…

What is the current approach for doing this?

Thanks (again) folks.

D.

Doesn’t

msg = ‘The price was $1’

work?

Putting $msg in the text component

There are several lines of text. I’m sorry for not being particularly python literate, but how would I format the following to be displayed over three lines?

A bat and a ball together cost $1.10.
The bat costs $1 more than the ball.
How much does the ball cost?

Thanks,

Dan.

Although, thinking about it - I guess I could use three different text components, one for each line.

D.

\n

is the code for a new line.

You can use ‘/$’ I think :slight_smile:

It would be \$ not /$

1 Like