Skip to main content
`Ctrl`+`K`

# vispy.geometry.rect module

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

  Bases: `object`

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

  Parameters:
    *args arguments

      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:
      x float

        X coordinate.

      y float

        Y coordinate.

    Returns:
      contains bool

        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:
      x bool

        Flip the X axis.

      y bool

        Flip the Y axis.

    Returns:
      rect instance 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:
      padding float

        The padding.

    Returns:
      rect instance of Rect

        The padded rectangle.

  property pos
  property right
  property size
  property top
  property width