class psychopy.visual.Rect(win, width=0.5, height=0.5, autoLog=None, units='', lineWidth=1.5, lineColor='white', lineColorSpace='rgb', fillColor=None, fillColorSpace='rgb', pos=(0, 0), size=None, ori=0.0, opacity=1.0, contrast=1.0, depth=0, interpolate=True, name=None, autoDraw=False)[source]

Creates a rectangle of given width and height as a special case of a ShapeStim

(New in version 1.72.00)

width, height

The width and height of the rectangle. Values are aliased with fields in the size attribute. Use these values to adjust the size of the rectangle in a single dimension after initialization.


float or int

  • win (~psychopy.visual.Window) – Window object to be associated with this stimuli.

  • height (width,) – The width and height of the rectangle. DEPRECATED use size to define the dimensions of the rectangle on initialization. If size is specified the values of width and height are ignored. This is to provide legacy compatibility for existing applications.

  • size (array_like, float or int) – Width and height of the rectangle as (w, h) or [w, h]. If a single value is provided, the width and height will be set to the same specified value. If None is specified, the size will be set with values passed to width and height.

mro() → list

return a type’s method resolution order

Back to top