RectangleF class

RectangleF class

Stores a set of four floating-point numbers that represent the location and size of a rectangle. Compatible with .NET System.Drawing.RectangleF.

Inheritance:RectangleF → Rectangle

The RectangleF type exposes the following members:

Constructors

ConstructorDescription
__init__(self, x=0.0, y=0.0, width=0.0, height=0.0)Creates a rectangle with the specified location and size.

Properties

PropertyDescription
xGets the x-coordinate of the upper-left corner of this rectangle.
Read-only float.
yGets the y-coordinate of the upper-left corner of this rectangle.
Read-only float.
widthGets the width of this rectangle.
Read-only float.
heightGets the height of this rectangle.
Read-only float.
leftGets the x-coordinate of the left edge of this rectangle. Equals to x.
Read-only float.
topGets the y-coordinate of the top edge of this rectangle. Equals to y.
Read-only float.
rightGets the x-coordinate that is the sum of x and width of this rectangle.
Read-only float.
bottomGets the y-coordinate that is the sum of y and height of this rectangle.
Read-only float.
is_emptySpecifies whether all numeric properties of this rectangle have values of zero.
Read-only bool.

Methods

MethodDescription
contains(self, x, y)Determines if the specified point is contained within this rectangle.
contains(self, point)Determines if the specified point is contained within this rectangle.
contains(self, rect)Determines if the rectangular region represented by rect is entirely contained within this rectangle.

Remarks

Rectangles are compared by their location and size with == and can be used as dictionary keys or set members.

See Also