How to randomize two image locations from the same row from an excel sheet presented on the same screen

Hello,
I am trying to build a task that asks to choose between two images on the screen.
In my excel file I have one row for the correct response and the other is the incorrect decision. Basically I don’t want every correct image appearing on one side of the screen and the wrong on the other for every trail.

These images are presented in predetermined pairs so I cannot randomize both columns. Is there a way for Psychopy to randomize the location of the images on the screen?

Thank you in advance

What I do is always have the correct image in one of the two image components but then independently randomise the locations of the two images.

If you’re happy for this to be full random then you could simply have the following code

Begin Experiment

positions = [[-.3,0],[.3,0]]

Begin Routine

shuffle(positions)
thisExp.addData('TargetX',positions[0][0])

Then put the target position as positions[0] and the foil position as positions[1]

Thank you for that. Would this work if in the same trial I am presenting an image from the same Excel row? As a disclaimer I know very little about Python. How the trial goes

  1. An image is shown from column A in the excel file.
  2. Viewers must choose between the images matched with the row number from file A with the corresponding B and C files (target and deception image)

So in turn I am not shuffling the all of the images, just the images from column B and C

Here is the excel sheet. the deception image stimuli has yet to be created, that’s why they are all the same. I just want to figure out the psychopy first if possible