Spacing between individual dots on a grid

Hello,

I’m trying to build an experiment in which there is a 3x3 grid with 9 points at equal adjustable distances, so that on the screen it will show me each time only one point that will be randomly selected from the grid. I built the grid (I added the code below) but I can’t control the spacing between the points. In my code, if I change the x_spacing or the y_spacing, it only changes the distance of each row from the edge of the window.

  • I haven’t added the randomization part yet, because I can’t finish building the grid

I would love to get some help,
Thank you in advance!


I would have dots= in line12 and replace line 18 with

dots.append(visual.Circle(win, radius=dot_size, follColor=dot_color, pos = (x,y))

Then delete line 20.

Unfortunately it doesn’t work, it still displays the same thing it displayed before (which cuts the dots on the top row and the dots on the bottom row)
If you have any other suggestions I would love to hear them but anyway, thanks for the response!

I’ve just written a new demo called points on a grid which might help.

Points on a grid | code | try it

Creates a list of points in a grid with an arbitrary number of rows and columns. The points are then shuffled and used to assign positions of either text, image, polygon or shape stimuli. The centre element can be skipped if desired.

First of all thank you very much for your help and effort and sorry for replying so late, it was a holiday in my country.

Unfortunately, I did not quite understand how to approach your answer in relation to my question. I saw the “points-on-grid”, but what I need in the end is a 3x3 grid in which I will define parameters between the points themself (so that I can change the distances between them easily, which is what I am struggeling now), when in each trial only one point from the grid appears for t time and between trial and trial a fixation point in the center of the grid.

And I need it in PsychoPy since this is only the first stage of a long experiment.
Did you mean I need to take part of the code you wrote and use it in Psychopay? Does your answer mean that it is not possible in your opinion to reach what I am looking for with the code I wrote?

Once again, thank you very much for your help and effort!

I assume you are using norm units.

If you include -1 and 1 in the coordinates then the centre of those dots will be on the border of the screen, and those dots will therefore be half off the screen.

To display just one dot from your grid then pick a number between 0 and len(dots) to draw instead of drawing them all.

It worked! Thank you very much for all the help.
I’m adding my code so it might help people in the future -