vispy.geometry.rect module#

class vispy.geometry.rect.Rect(*args, **kwargs)#

Bases: object

Representation of a rectangular area in a 2D coordinate system.

Parameters:
*argsarguments

Can be in the form Rect(x, y, w, h), Rect(pos, size), or Rect(Rect).

property bottom#
property center#
contains(x, y)#

Query if the rectangle contains points

Parameters:
xfloat

X coordinate.

yfloat

Y coordinate.

Returns:
containsbool

True if the point is within the rectangle.

flipped(x=False, y=True)#

Return a Rect with the same bounds but with axes inverted

Parameters:
xbool

Flip the X axis.

ybool

Flip the Y axis.

Returns:
rectinstance of Rect

The flipped rectangle.

property height#
property left#
normalized()#

Return a Rect covering the same area, but with height and width guaranteed to be positive.

padded(padding)#

Return a new Rect padded (smaller) by padding on all sides

Parameters:
paddingfloat

The padding.

Returns:
rectinstance of Rect

The padded rectangle.

property pos#
property right#
property size#
property top#
property width#