Previous topic

ElementArrayStim

Next topic

MovieStim

This Page

Quick links

Line

class psychopy.visual.Line(win, start=(-0.5, -0.5), end=(0.5, 0.5), **kwargs)

Creates a Line between two points.

(New in version 1.72.00)

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

Parameters :
win :

A Window object (required)

start : tuple, list or 2x1 array

Specifies the position of the start of the line

end : tuple, list or 2x1 array

Specifies the position of the end of the line

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='')
setEnd(end)

Changes the end point of the line. Argument should be a tuple, list or 2x1 array specifying the coordinates of the end point

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

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.

setStart(start)

Changes the start point of the line. Argument should be

  • tuple, list or 2x1 array specifying the coordinates of the start point
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.