Skip to main content

Size

A 2D size with width and height.

Properties

Methods

Properties

aspect_ratioproperty

aspect_ratio: float

Returns the aspect ratio (width / height).

heightinstance-attribute

height: Number

widthinstance-attribute

width: Number

Methods

copy

copy(width: Optional[Number] = None, height: Optional[Number] = None)

Returns a copy of this object with the specified properties overridden.

from_heightclassmethod

from_height(cls, height: Number)

Creates a Size with the given height and an infinite width.

from_radiusclassmethod

from_radius(cls, radius: Number)

Creates a square Size whose width and height are twice the given radius.

from_widthclassmethod

from_width(cls, width: Number)

Creates a Size with the given width and an infinite height.

infiniteclassmethod

infinite(cls)

Creates a Size whose width and height are both positive infinity.

is_finite

is_finite()

Checks if both dimensions are finite.

is_infinite

is_infinite()

Checks if either dimension is infinite.

squareclassmethod

square(cls, dimension: Number)

Creates a square Size where width and height are the same.

zeroclassmethod

zero(cls)

Creates a Size whose width and height are both 0.0.