psychopy.org | Reference | Downloads | Github

Shape with continuous line for large lineWidth

The following attempt to draw a square with a thick line

from psychopy import visual, event
win = visual.Window()
visual.Rect(win, size=0.2, lineWidth=20).draw()  # the critical line! The ShapeStim
win.flip()
event.waitKeys()  # To keep it on the screen

produces this shape:

How do I make it a proper square with proper corners? This problem applies to all ShapeStims, e.g. Polygon.

How such a thing is drawn depends on the graphics card driver. PsychoPy merely tells the OpenGL drivers to draw the lines. For your needs I would construct a bitmaped image stim (or grating stim) that had exactly the shape I wanted. You could do that using a numpy array if it helped to keep everything in your script

It would be a hack, but In a previous post, Michael suggested drawing a big white square with a smaller grey one inside.