psychopy.org | Reference | Downloads | Github

French accents in text in builder

Dear all,

I remember a few years ago in college I had few Psychopy courses but the teacher said we can’t use accents. The program has been updated a few times since… Hence, can I use words with accents in the text component in the Builder? Such as é, è, à, ç…

Psychopy version 1.84.2
Windows 7

Cordially,
Joseph

Yes. There are two basic things you should start making a habit to allow for this.

If you’re ever writing some of the code yourself you’ll need to add a u in front of the string to make it a Unicode object. This is necessary in Python 2, the version of Python used by psychopy, but is not necessary in Python 3.

good = u"maître"
bad = "maître"

I personally try to always use Unicode objects like this when writing strings that will be seen by a user, just to get in the habit. Note that in the builder, psychopy reads the text you entered as Unicode, so you only have worry about this when writing code.

The next one is done for you in psychopy-generated scripts, but if you’re writing your own code from scratch, you’ll also have to add this to the top of your code file so that Python will allow such characters in your code file:

#-*- coding: utf-8 -*-

Hi Daniel,

Thanks for your response. I haven’t touched the script so far. The text was inserted in the builder directly.
So I have to edit the text in the script so my program won’t crash due to the accents?

Cordially,
Joseph

Nope, it should all work out of the box.

It works great.
Thank you Daniel.

Cordially,
Joseph