Previous topic

RatingScale

Next topic

ShapeStim

This Page

Quick links

Rect

class psychopy.visual.Rect(win, width=0.5, height=0.5, **kwargs)

Creates a rectangle of given width and height as a special case of a ~psychopy.visual.ShapeStim

(New in version 1.72.00)

Rect accepts all input parameters, that ~psychopy.visual.ShapeStim accept, except for vertices and closeShape.

Parameters :
win :

A Window object (required)

width : int or float

Width of the Rectangle (in its respective units, if specified)

height : int or float

Height of the Rectangle (in its respective units, if specified)

draw(win=None)

Draw the stimulus in its relevant window. You must call this method after every MyWin.flip() if you want the stimulus to appear on that frame and then update the screen again.

setAutoDraw(val)

Add or remove a stimulus from the list of stimuli that will be automatically drawn on each flip

Parameters :
  • val: True/False

    True to add the stimulus to the draw list, False to remove it

setAutoLog(val=True)

Turn on (or off) autoLogging for this stimulus.

Parameters :
  • val: True (default) or False
setColor(color, colorSpace=None, operation='')

For ShapeStim use setLineColor() or setFillColor()

setContr(newContr, operation='')

Set the contrast of the stimulus

setDKL(newDKL, operation='')

DEPRECATED since v1.60.05: Please use setColor

setDepth(newDepth, operation='')
setFillColor(color, colorSpace=None, operation='')

Sets the color of the shape fill. See PatchStim.setColor() for further details of how to use this function.

Note that shapes where some vertices point inwards will usually not ‘fill’ correctly.

setFillRGB(value, operation='')

DEPRECATED since v1.60.05: Please use setFillColor()

setHeight(height)

Changes the height of the Rectangle

setLMS(newLMS, operation='')

DEPRECATED since v1.60.05: Please use setColor

setLineColor(color, colorSpace=None, operation='')

Sets the color of the shape edge. See PatchStim.setColor() for further details of how to use this function.

setLineRGB(value, operation='')

DEPRECATED since v1.60.05: Please use setLineColor()

setOpacity(newOpacity, operation='')
setOri(newOri, operation='')

Set the stimulus orientation in degrees

setPos(newPos, operation='', units=None)

Set the stimulus position in the specified (or inherited) units

setRGB(newRGB, operation='')

DEPRECATED since v1.60.05: Please use setColor

setSize(value, operation='')

Sets the size of the shape. Size is independent of the units of shape and will simply scale the shape’s vertices by the factor given. Use a tuple or list of two values to scale asymmetrically.

setUseShaders(val=True)

Set this stimulus to use shaders if possible.

setVertices(value=None, operation='')

Set the xy values of the vertices (relative to the centre of the field). Values should be:

  • an array/list of Nx2 coordinates.
setWidth(width)

Changes the width of the Rectangle