Skip to content

Line

Examples#

See these.

Line #

Bases: Shape

Draws a line between the given points using the given paint.

Note

The line is always rendered as a stroke, regardless of the value of paint's style property.

data #

data: Any = skip_field()

Arbitrary data of any type.

key #

key: (
    str | int | float | bool | ValueKey | ScrollKey | None
) = None

page #

page: Page | PageView | None

The page (of type Page or PageView) to which this control belongs to.

paint #

paint: Paint = field(default_factory=lambda: Paint())

A style to draw a line with.

parent #

parent: BaseControl | None

The direct ancestor(parent) of this control.

It defaults to None and will only have a value when this control is mounted (added to the page tree).

The Page control (which is the root of the tree) is an exception - it always has parent=None.

x1 #

x1: Number

The x-axis coordinate of the line's starting point.

x2 #

x2: Number

The x-axis coordinate of the line's end point.

y1 #

y1: Number

The y-axis coordinate of the line's starting point.

y2 #

y2: Number

The y-axis coordinate of the line's end point.

before_event #

before_event(e: ControlEvent)

before_update #

before_update()

This method is called every time when this control is being updated.

Note

Make sure not to call/request an update() here.

did_mount #

did_mount()

init #

init()

is_isolated #

is_isolated()

update #

update() -> None

will_unmount #

will_unmount()