Left Aligning text - does 'anchorHoriz' work - or how else to do this?

Ok I have seen various other posts mention this - and have experimented - but still can’t get this to work - forgive me for being thick.

I am trying to present two different words, of different length in such a way that the left side of the words being at the same horizontal position - close to boxes that particpants can click on. Ie: the text label to checkboxes.

I believe that text is aligned by an anchor in the centre of the object. I would like to be able to enter a co-ordinate and have the text appear FROM THE right of this location. Ie: left aligned.

How can I do this?

I tried entering the code:

Option1Text1.anchorHoriz = left

In the ‘Begin Routine’ code thingo, and this threw an error.

A/DPCL_Conway_A_upload_lastrun.py", line 4488, in <module>
    Option1Text1.anchorHoriz = left
NameError: name 'left' is not defined
##### Experiment ended. #####

But when I tried another parameter it worked fine, eg:


So… how can I left align text.

Thanks folks.

Crappy pic attached below (when I run a Psychopy experiment on my Mac it messes with the OS in very strange ways - including disabling screencaptures - hence this crappy pic. Apologies.


Try putting left in quotes so it is interpreted as text, not a variable.

Hi @wakecarter.

Ok - so including the quotation marks no longer throws an error, and it does change where the text appears on screen - but I don’t really understand what it’s doing - and it’s certainly not left aligning the text objects. Hmmm…

Here’s a photo (again apologies - running Pyschopy on my Mac seems to disable the OS screencapture facility). The bottom two pieces of text are both set to appear at the same X location on-screen and my code sets their horizanchor to left for both of them.

text2lower_left.anchorHoriz = "left"
text2lower_left_short.anchorHoriz = "left"



I think what I can see is centre alignment with a left anchor. The left hand edge of the text box is at x=0 but it has width 1 so the text centred at x=0.5. You also need to left align the text within the text box.

Ah. Ok. Cool.

How do I do this?


(In the meantime I have written code to detect which word is being used and programatically update the X psoition accordingly).


Ah terrific.

Thanks. Will give that a go.