psychopy.org | Reference | Downloads | Github

Text component shows "Hello World" instead of "= ="

Erm, this is a bit of a weird one (well, at least for someone who doesn’t really know anything about JavaScript). I would like to display the text = = on screen. This text comes from a .csv condition file. It works perfectly fine using PsychoPy. However, on Pavlovia, the text Hello world is displayed instead of = =.
The effect is specific to the (leading) equal sign. That is, the issue does not occur if a different character is shown on screen, e.g. a a. The issue does also not occur if I add a space before and after the equal signs in the condition file. However, this does not work as a fix, because, while the leading space is honoured, the trailing space is ignored, and the stimulus is no longer centred on screen.

I would be very grateful for any suggestions on how to solve this issue.

Jan

A few more insights:

  • The problem only occurs when reading text from an input file
    • When = = is entered directly into the text box, it works
  • It seems the problem occurs when (a) the first character is an equal sign AND (b) there is at least one other equal sign somewhere in the text
    • = works
    • a== works
    • == does not work (i.e., shows Hello world)
    • =a= does not work
    • =a=a does not work
    • =a=a=a does not work

Jan

How about “==” ?

You mean adding the quotes in the input file? This still shows “Hello world” I’m afraid.

Thanks for the suggestion though, @wakecarter.

Jan

I’ve fixed this using a workaround. In the input file, I replaced = = with dummy. Below the text component displaying the stimulus I then added a code component that replaces dummy with = = (see code below). This appears to work both on PsychoPy and on Pavlovia (with auto-translated code).

if stim == "dummy":
    stimText.setText("= =")

Jan

1 Like