Rect
A 2D, axis-aligned, floating-point rectangle whose coordinates are relative to a given origin.
Properties
bottom- The offset of the bottom edge of this rectangle from the y-axis.height- The distance between the top and bottom edges of this rectangle.left- The offset of the left edge of this rectangle from the x-axis.right- The offset of the right edge of this rectangle from the x-axis.size- The distance between the upper-left corner and the lower-right corner of this rectangle.top- The offset of the top edge of this rectangle from the y-axis.width- The distance between the left and right edges of this rectangle.
Methods
copy- Returns a copy of this object with the specified properties overridden.from_center- Constructs a rectangle from its center point, width, and height.from_lwth- Construct a rectangle from its left and top edges, its width, and its height.from_points- Construct the smallest rectangle that encloses the given offsets, treating them as vectors from the origin.
Properties
bottominstance-attribute
bottom: NumberThe offset of the bottom edge of this rectangle from the y-axis.
rightinstance-attribute
right: NumberThe offset of the right edge of this rectangle from the x-axis.
Methods
copy
copy(left: Optional[Number] = None, top: Optional[Number] = None, right: Optional[Number] = None, bottom: Optional[Number] = None)Returns a copy of this object with the specified properties overridden.
from_centerclassmethod
Constructs a rectangle from its center point, width, and height.
The center argument is assumed to be an offset from the origin.
from_lwthclassmethod
Construct a rectangle from its left and top edges, its width, and its height.