Align stimulus position from left margin

Description of task: I am using builder to create two stacked rectangular polygons. On each trial, each of polygons change in their length (one is shorter, one is longer)

Problem: Using the default pos [0, 0] will result in polygons centered at [0,0], such that the left margins of the polygons are misaligned.

Question: What should be adjusted so that the left margins of the stimuli are vertically aligned?

I think the property you want is anchor

Thank you! I’ve upgraded to the latest psychopy and the anchor attribute shows up.

1 Like

Do you know if anchor works on Pavlovia? I use 2022.2.4 but anchor not seems to be working online.

In the next release we’ll have added anchor fully to both sides, but in 2022.2.4 it’s only implemented online within the PsychoJS library, i.e. PsychoJS can accept and understand anchor but PsychoPy doesn’t supply it when writing JS code. What this means essentially is that you need to set anchor after creation through a :code: Code component, so having something like this in the Begin Routine tab:

myPolygon.anchor = "left"