psychopy.org | Reference | Downloads | Github

Bug: Dollar sign turns code into text

In PsychoPy 2021.2.3 (using Javascript):

The dollar sign ($) as code indicator in any TextBox’s Text property appears to be foiled by another dollar sign.

So this works: $Math.E+'%' generates 2.72% as expected.
But this does not: $Math.E+'$' generates Math.E+'$' instead of 2.72$.
This also behaves strangely: $Math.E+'\$' generates 2.72\$ instead of 2.72$.

This functionality used to work in previous versions of PsychoPy (eg, 2020.2.4). The issue may be related to '\$' solution for text with dollar signs no longer works on Builder or Use $ symbol and mulitple colors in the text - #7 by feinbergdavid

A workaround: $Math.E+String.fromCharCode(36) generates: 2.72$ as expected.

Hi There,

Thanks for reporting this and thanks for providing a solution - it looks like a bug alright! probably best fixed through the transpiler in PsychoPy - would you be happy to raise that as an issue on the psychopy github?

Thanks!
Becca

Done.

1 Like