FL.objects.Rect.Rect

class FL.objects.Rect.Rect(r_or_p0_or_x0: Rect | Point | float | None = None, p1_or_x0: Point | float | None = None, x1: float | None = None, y1: float | None = None)

Bases: Copyable

Rect - base class to represent rectangle

Integer or float values are accepted as coordinates

__init__(r_or_p0_or_x0: Rect | Point | float | None = None, p1_or_x0: Point | float | None = None, x1: float | None = None, y1: float | None = None) None
Rect()

generic constructor, creates a Rect with zero coordinates

Rect(Rect r)

copy constructor

Rect(Point p)

creates rectangle with one corner at (0, 0) and another at coordinates defined by p

Rect(Point p0, Point p1)

creates rectangle defined by the corner points

Rect(x0, y0, x1, y1)

creates a rectangle defined by the coordinates of the corner points

Parameters:
  • r_or_p0_or_x0 (Rect | Point | float | None, optional) – _description_. Defaults to None.

  • p1_or_x0 (Point | float | None, optional) – _description_. Defaults to None.

  • x1 (float | None, optional) – _description_. Defaults to None.

  • y1 (float | None, optional) – _description_. Defaults to None.

Methods

Assign([r_or_p0_or_x0, p1_or_x0, x1, y1])

Assigns new values to a Rect, the same as constructor

Check(r_or_p)

Include(r_or_p_or_x[, y])

Resize()

Shift(p_or_x[, y])

Transform(m)

Validate()

Corrects rectangle's orientation

__init__([r_or_p0_or_x0, p1_or_x0, x1, y1])

Rect()

Attributes

height

ll

position of the left/bottom corner

ur

position of the right/top corner

width

x

y

Assign(r_or_p0_or_x0: Rect | Point | float | None = None, p1_or_x0: Point | float | None = None, x1: float | None = None, y1: float | None = None) None

Assigns new values to a Rect, the same as constructor

Parameters:
  • r_or_p0_or_x0 (Rect | Point | float | None, optional) – _description_. Defaults to None.

  • p1_or_x0 (Point | float | None, optional) – _description_. Defaults to None.

  • x1 (float | None, optional) – _description_. Defaults to None.

  • y1 (float | None, optional) – _description_. Defaults to None.

Validate() None

Corrects rectangle’s orientation

property ll: Point

position of the left/bottom corner

property ur: Point

position of the right/top corner