If this template helps then use it. If not then just delete and start from scratch.
OS (e.g. Win10): OSX 12.5.1
PsychoPy version : 2022.1.4
Standard Standalone? (y/n) Yes
What are you trying to achieve?: Add a small value to a randomly generated stimulus position
What did you try to make it work?:
I am presenting 9 stimuli at pseudorandom positions. For that, I am using the code that is provided in the book Building experiments in PsychoPy for the visual search task (Chapter 11). I generate two vectors with positions using the code component, shuffle them on each trial and then assign the different x- and y-values to my stimuli.
Each stimuli gets the following info: e.g. (x_pos[1], y_pos[1]), under position in the stimulus properties.
Now I need to add an additional small stimuli next to one of these 9 stimuli. Its position is based on the position of the first stimulus and then I add a small value to the x-position in order to move it either the left or the right. This value comes from a conditions file.
My attempt was to add this value (variable is called dotPos) to the original x-position:
e.g. (x_pos[0]+dotPos, y_pos[0])
What specifically went wrong when you tried that?:
The error message I get is: TypeError: unsupported operand type(s) for +: ‘int’ and ‘NoneType’
I think the issue is that x_pos[0] is just pointing at a location in the position vector, so I might not be able to add something…