Previous topic

PatchStim - the main stimulus class for presenting images

Next topic

RadialStim

This Page

Quick links

Polygon

class psychopy.visual.Polygon(win, edges=3, radius=0.5, **kwargs)

Creates a regular polygon (triangles, pentagrams, ...) as a special case of a ~psychopy.visual.ShapeStim

(New in version 1.72.00)

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

Parameters :
win :

A Window object (required)

edges : int

Number of edges of the polygon

radius : float, int, tuple, list or 2x1 array

Radius of the Polygon (distance from the center to the corners). May be a -2tuple or list to stretch the polygon asymmetrically

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()

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

setRadius(radius)

Changes the radius of the Polygon. Parameter should be

  • float, int, tuple, list or 2x1 array
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.