# Text Alignement Issue

**URL:** <https://discourse.psychopy.org/t/text-alignement-issue/17317>\
**Category:** Coding\
**Tags:** text\
**Created:** [October 16, 2020, 8:14pm UTC](https://discourse.psychopy.org/t/text-alignement-issue/17317 "2020-10-16T20:14:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbanker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/sbanker/32/38546_2.png) [@sbanker](https://discourse.psychopy.org/u/sbanker)\
**Post date:** [October 16, 2020, 8:14pm UTC](https://discourse.psychopy.org/t/text-alignement-issue/17317/1 "2020-10-16T20:14:22Z")

</div>

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:

```auto
    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?

---

<div class="post-metadata">

**Author:** ![sbanker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/sbanker/32/38546_2.png) [@sbanker](https://discourse.psychopy.org/u/sbanker)\
**Post date:** [October 19, 2020, 6:00pm UTC](https://discourse.psychopy.org/t/text-alignement-issue/17317/2 "2020-10-19T18:00:26Z")

</div>

Update:

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

```auto
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:

```auto
    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!
