| Reference | Downloads | Github

Set image position based on previous screen

Hi! I’m trying to set the position of an image (e.g., TD_Correct in Routine 2) to be the same as an image that appeared in the previous routine (e.g., TO_Correct in Routine 1).

Right now, TO_Correct and TO_Incorrect (in Routine 1; see below) are coded to appear either on the left or right of the screen and I want to make sure that in the next routine, the positions of TD_Correct and TD_Incorrect correspond to TO_Correct and TO_Incorrect respectively.

Is there some code that I can use to achieve this? Thank you :slight_smile:

Routine 1:

Code for TO_Correct and TO_Incorrect position:
imPositions = [(-0.35, 0), (0.35, 0)]
shuffle(imPositions) # to randomize first position

Routine 2:

If I’m understanding correctly, you would just use the same code you already have but add TD_Correct.setPos(imPosition[0]) (and with incorrect). Then it will set them both at the same time.

Thanks for your help sal! It turns out I just needed to include the following code and I managed to have the images be in the same position for the TD and TO routines:

TD_Correct.setPos(TO_Correct.pos) #set image positions to be the same as in the TO task