| Reference | Downloads | Github

Get polygon component position

Hi, this is probably a very simple problem but I am having so much trouble. For my experiment, I would like to grab the positions of all the polygons and save it in a dictionary or array for reference later. In the code component, I was able to do dict[0] = polygon.pos and it will work fine for pyschopy. But when it is uploaded to Pavlovia it gave of error of can’t read property of undefined. Is there a different way to reference the position of the polygon component for the online experiment? Thank you!

1 Like

How are you drawing the polygons? Don’t you already know their positions?

They are pre-set, but essentially my experiment is a drag and drop page of text components. I want to know the position of the polygons so I can calculate if the text components are in the right polygons.

Since you can check whether a mouse is in a text component online you’ll need to have additional polygons with the same coordinates as the text components.

Oh I do have that. I have polygon for each text so I can drag and drop. But I want to check if each text ended up in the right “answer box” on the right. To do that I think I’ll need to grab the position of the answer polygons and check with the each of the selections. But I am not able to access the polygon positions by just doing polygon.pos like how it is done in Psychopy. I attached a picture of what the experiment essentially looks like. Thank you!