textStim alignment alignHoriz alignVert

Hi all,

I’m very new at psychopy and try some builder and coder experiment.
I’m working on mac os x 10.13.3 and psychopy 1.85.6.
And…I’ve got a little problem.
I played with testStim through coder and I was trying to align the text to the left with this code:

from psychopy import visual, core 
win = visual.Window()
msg = visual.TextStim(win,alignHoriz='left', height=0.1,wrapWidth=None, text=u"text text text text text text text text text text text text \ntext text text text  \n\ntext .")
msg.draw()
win.flip()
core.wait(1)
win.close()

However, alignHoriz=‘left’ actually aligns the text to the…right!

I think I miss something essential but I don’t get it!
What’s the tips ?

Are you sure about that?

To be honest…no ^^’
I think I misunderstood something, as when I set alignHoriz=‘right’, I get this:

OK. I was confused too. I just did a bit of testing and it looks like that setting is not really about aligning the text within the boundaries of the stimulus, but instead sets where the anchor point of the stimulus is. e.g. if the stimulus position is [0, 0], then if alignment is 'center' then the stimulus is centred horizontally on the screen (i.e. text will appear on either side of 0). If it is 'left', then the left boundary of the stimulus is 0 (i.e. all text will be on the right half of the screen). Conversely, if alignment is 'right', then the right boundary of the stimulus is 0, and all text will be to the left of it.

No, it doesn’t seem obvious, and maybe the documentation needs to be edited accordingly?

I first had a headache while reading your reply but then, I began to understand…
If I understand correctly pos and alignHoriz work together: alignHoriz will align the stimulus from the position defined by pos?

Indeed, I do not find this very obvious - but I’m a beginner :wink:

It looks like it.

Don’t worry, I don’t get it either.

Thanks for the clarification!