psychopy.org | Reference | Downloads | Github

Unable to dislay new line in text object on Windows 10

Dear psychopy experts,

I have a puzzling problem with psychopy TextStim which ONLY occurs on Windows 10.
Here it is: I cannot get the line breaks in textstim displayed. Instead I get a box, and all on one line.
The line for utf-8 coding is included in the script, and the text is likewise coded as u’text \n\text’
On windows 7 and the identical Psychopy version (v1.83.01) the code runs without a problem. However, I need to show it to participants on the Windows 10 touchscreen machine.

I have tried the following solutions, none of which worked:

  • changed windows system language and input language
  • changed font
  • changed newline preferences to dos and replaced \n with \r\n (returns two little boxes instead of one)
  • loaded the text into a string variable and encoded (.encode(‘UTF-8’)) and then called the variable in textstim
  • regenerated the code from builder

Any solution suggestions would be most appreciated!

Best,
Bettina

Sorry Bettina, I honestly don’t know the answer either. :-/
The latest version of PsychoPy uses a newer version of pyglet though (which is the library that handles text rendering for PsychoPy) so maybe using that will fix the issue for you?

Dear Jon,
Thank you for your answer and the suggestion; an upgrade to the 1.84.0 Standalone version did indeed fix the issue.
Is there a way for me to manually install the newer version of pyglet with the 1.83.03 version?
I’m asking because I have one code which only runs in the 1.83.03 version, but crashes on all later ones. If not, we can do a work around where we use two devices for two different tasks, but this is obviously a bit tedious.
Thank you again for your support!