expyfun.visual.Rectangle#

class expyfun.visual.Rectangle(ec, pos, units='norm', fill_color='white', line_color=None, line_width=1.0)[source]#

A rectangle.

Parameters:
ecinstance of ExperimentController

Parent EC.

posarray-like

4-element array-like with X, Y center and width, height where x and y are coordinates of the center.

unitsstr

Units to use. These will apply to all spatial aspects of the drawing. shape e.g. size, position. See check_units for options.

fill_colormatplotlib Color | None

Color to fill with. None is transparent.

line_colormatplotlib Color | None

Color of the border line. None is transparent.

line_widthfloat

Line width in pixels.

Methods

draw()

Draw the object to the display buffer.

set_fill_color(fill_color)

Set the object color

set_line_color(line_color)

Set the object color

set_line_width(line_width)

Set the line width in pixels

set_pos(pos[, units])

Set the position of the rectangle

Returns:
lineinstance of Rectangle

The rectangle object.

draw()[source]#

Draw the object to the display buffer.

set_fill_color(fill_color)[source]#

Set the object color

Parameters:
fill_colormatplotlib Color | None

The fill color. Use None for no fill.

set_line_color(line_color)[source]#

Set the object color

Parameters:
line_colormatplotlib Color | None

The fill color. Use None for no fill.

set_line_width(line_width)[source]#

Set the line width in pixels

Parameters:
line_widthfloat

The line width. Must be given in pixels. Due to OpenGL limitations, it must be 0.0 <= line_width <= 10.0.

set_pos(pos, units='norm')[source]#

Set the position of the rectangle

Parameters:
posarray-like

X, Y, width, height of the rectangle.

unitsstr

Units to use. See check_units for options.

Examples using expyfun.visual.Rectangle#

Sound level test and visual size calibration

Sound level test and visual size calibration

Experiment drawing methods

Experiment drawing methods

Mouse click demo

Mouse click demo

A-V sync test

A-V sync test