Text box/polygon response - change options between subjects

OS : Win10
PsychoPy version: 2024.2.4 Py 3.8):
Standard Standalone Installation? (y/n) yes
Do you want it to also run online? (y/n) yes
What are you trying to achieve?: I am trying to run a mouse tracking experiment. The responses are mouse clicks on text boxes + rectangular polygons. There are two options, one in the upper right corner (A) and the other in the upper left corner (B). I would like half of the participants to have these options and the other half to have the response options reversed, i.e., upper right corner (B) and upper left corner (A).

Thanks a lot!

Since mouse responses refer to component names rather than locations, it is fairly easy to randomise the locations (e.g. via spreadsheet or code component) and not change the mouse code.

Thanks, @wakecarter ! Do you have any suggestion/concrete example how can I do this? (via spreadsheet or code component)? Thanks again!

Here is the basic code (Begin Experiment)

positions = [[-.4,.4],[.4,.4]]
if int(expInfo['participant']) % 2 == 1:
     positions = [[.4,.4],[-.4,.4]]

Then use positions[0] for the position of one option and positions[1] for the other.

This will allocate the positions based on whether the participant number is odd or even.

This will be random. If you want the same number in both groups you need counterbalancing,

Thanks @wakecarter!

Where should I include the suggested code (Begin Experiment)? Should I create a new routine at the beginning of the study, or should I include this code in the routine that contains the mouse component?

The code component can be anywhere before the objects. I normally have a code component in my instructions routine.

Thanks again! I tried it, changing the positions for my study, but it’s not working
positions = [[-.6,.4],[.6,.4]]
if int(expInfo[‘participant’]) % 2 == 1:
positions = [[.6,.4],[-.6,.4]]

Please clarify.