Text Alignement Issue

Hello!

I’m using Psychopy v2020.2.4 - I’m trying to set the alignment of my text to either ‘left’ or ‘center’, depending on the content of the text. Right now, I have:

    Text1.setColor(Text_Color, colorSpace='rgb')
    Text1.setPos(Text_Position)
    Text1.setText(Text)
    Text1.setHeight(Text_Size)
    Text1.setAlignText(Align)

Where Text_Color, Text_Position, Text, Text_Size, and Align are variables in an excel sheet. The task loads all of the other information correctly, but does not seem to update the alignment (the text is always displayed as center-aligned). The Align column in my excel file contains either [‘left’] or [‘center’].

Any ideas?

Update:

If I add alignText=‘left’ into my code, I can get all the text to be left-aligned:

Text1 = visual.TextStim(win=win, name='Text1',
    text='default text',
    font='Arial',
    pos=[0,0], height=1.0, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR', alignText='left',
    depth=-6.0);

However, adding “Text1.setAlignText(Align)” further down in the code still does not seem to do anything:

    Text1.setColor(Text_Color, colorSpace='rgb')
    Text1.setPos(Text_Position)
    Text1.setText(Text)
    Text1.setHeight(Text_Size)
    Text1.setAlignText(Align)

With this line in place, the window opens but crashes before the tasks begins. I need the text to be aligned either left or center depending on the trial - so I need this line of code to draw from my excel sheet to set the alignment. Is setAlignText not an actual function? This seems like an oversight…

Thanks for your help!