Drawing oval and positioning shapes within a window

Hi there,

For general points on how to draw things in particular places, you might want to start with PsychoPy’s own tutorial:

https://www.psychopy.org/coder/tutorial1.html

And also Damien Mannion’s tutorial:

https://www.djmannion.net/psych_programming/vision/draw_shapes/draw_shapes.html

In general though, it is the “pos” (position) argument which controls positioning - it requires coordinates in whatever units you designated when you created the window. See here for more detail on units. Most, if not all stimuli objects have this argument.

To get an oval, it’s probably easiest to generate a Grating stim and set the size to something rectangular. Then, set the “mask” argument to “circle”, and you will have an ellipse with the same height and width of the rectangular dimensions you set. The code below should get you started!

win = visual.Window(size=[800, 800], fullscr=False, units="pix")

# "size" in pixels is narrower than it is tall (a rectangle).
# "pos" is "(0,0)" - the centre of the screen.

ellipse = visual.GratingStim(win, tex=None, mask='circle', size=(300,600), \
                                      color=(1,1,1), pos=(0,0), texRes = 1024)

ellipse.draw()

win.flip()