psychopy.org | Reference | Downloads | Github

How can I align text to the left in java script using code component?

Hi there!

Description of the problem:

Py: instr.alignText=‘left’ (works offline)
auto-translates to
JS: instr.alignText = “left”;

… but this doesn’t work.

‘instr’ is the name of the text component in the ‘instructions’ routine.

Does anybody know the correct JS code?

Thanks :slight_smile:

instr.setAlignHoriz('left');

Well, ok, now the text is left aligned - but also displaced to the right side of the screen …

What can I do if I want the text to appear at the screen center but left aligned?

Thanks again!!

Give it an x position of minus half the wrap width.

what does this mean? X position of what? thanks.

The text component.