psychopy.org | Reference | Downloads | Github

Saving polygon position as number

Hi everyone,

in a routine I have a bunch of polygons, that the participant can move by clicking on them and dragging with the mouse. I want to save the final position of these polygons, but using .pos (e.g. thisExp.addData(“final_pos”, myPolygon.pos) saves the coordinates in this format: [xy] (e.g. [-0.25 -0.3 ]).

Is there a way to save this information as a number? Preferably as two separate numbers: (e.g. final_pos_x = -0.25, final_pos_y = -0.3)

In the end the solution was not that complicated, here for posterity:

pos_x = myPolygon.pos[0]
thisExp.addData("pos_x", pos_x)

pos_y = myPolygon.pos[1]
thisExp.addData("pos_y", pos_y)