Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

Print instruction page in French

JulietteJuliette Posts: 18

My task's instruction page is in Canadian French. As you know French has some accent such as (à,é,l'association..etc).
I used the code below to display instruction page:

    import expyriment

    exp = expyriment.design.Experiment(name="semantic task ")
    expyriment.control.initialize(exp)
    instruction = expyriment.stimuli.TextLine(text=" "Nous allons faire une tâche d'association sémantique ")
    instruction.preload()
    expyriment.control.start()
    instruction.present()
    exp.clock.wait(4000)
    expyriment.control.end()

It give me error blow:

    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 6: ordinal not in range(128).

I have 2 questions regarding this problem:

1) How can I print a French sentence in the instruction page? for example, the text as you can see in the French sentence we have d'association sémantique ". Unfortunately, Python editor considers d' as a beginning of quotation and end of the semantique" as the second quotation and that's why I have syntax error all the time. Do you have any solution for this problem?

2) I wanted to give infinite time to the participant for instruction page and say "if you read and understand instruction page press any key to continue". How can I set press any key to continue in expyriment and how I can give infinite time to the participant.

Thank you very much for your comment in advance.

Comments

  • fladdfladd Posts: 69

    Hi Juliette,

    1) Please see our documentation on this: http://docs.expyriment.org/Unicode.html

    2) exp.keyboard.wait() will wait for any key

    Thanked by 1Juliette

    Florian Krause (Developer)
    http://www.expyriment.org

  • JulietteJuliette Posts: 18

    Hi Florian,

    Thank you for your comment.
    I have one instruction page for the participant ( 10 lines of text) But using commad expyriment.stimuli.TextLine It prints all the 10 lines text in one very very long line. In order to solve this problem I break out my sentences in few smaller lines as you can see below:

        instruction1_page = expyriment.stimuli.TextLine(text= u"Nous allons faire une tâche d' 
                association     sémantique. Trois mots disposés en pyramide",position=(0,200))
        instruction2_page = expyriment.stimuli.TextLine(text= u"vont apparaître:une en haut et deux en 
                bas. Votre tâche consiste a choisir entre les ",position=(0,200))   
    
        instruction1_page.preload()
        instruction2_page.preload()
    
        expyriment.control.start()
        instruction1_page.present()
        instruction2_page.present()
    

    But it still prints instruction lines of 1 and 2 in one long line instead of printing first text on the first line and prints the second text in the second line. Do you have any solution how can I have text1 \n (next line) text 2 and so on, please?

  • fladdfladd Posts: 69

    Hi Juliette,

    please see the documentation for TextBox and TextScreen for multi-line text.

    Best,
    Florian

    Thanked by 1Juliette

    Florian Krause (Developer)
    http://www.expyriment.org

Sign In or Register to comment.