Skip to main content

StrokeJoin

Styles to use for line segment joins.

Inherits: enum.Enum

Properties

  • BEVEL - Joins between line segments connect the corners of the butt ends of the line segments to give a beveled appearance.
  • MITER - Joins between line segments form sharp corners.
  • ROUND - Joins between line segments are semi-circular.

Examples

Showcase

import flet as ft
import flet.canvas as cv


def showcase_card(stroke_join: ft.StrokeJoin) -> ft.Container:
return ft.Container(
width=280,
padding=12,
border=ft.Border.all(1, ft.Colors.RED),
border_radius=10,
bgcolor=ft.Colors.SURFACE_CONTAINER_LOW,
content=ft.Column(
spacing=8,
controls=[
ft.Text(stroke_join.name, weight=ft.FontWeight.BOLD),
cv.Canvas(
width=240,
height=120,
shapes=[
cv.Path(
elements=[
cv.Path.MoveTo(40, 95),
cv.Path.LineTo(120, 25),
cv.Path.LineTo(200, 95),
],
paint=ft.Paint(
style=ft.PaintingStyle.STROKE,
stroke_width=24,
color=ft.Colors.PRIMARY,
stroke_cap=ft.StrokeCap.BUTT,
stroke_join=stroke_join,
),
)
],
),
],
),
)


def main(page: ft.Page):
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER

page.appbar = ft.AppBar(title="StrokeJoin Showcase")
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
ft.Text("Compare corner rendering for each StrokeJoin value."),
ft.Row(
wrap=True,
spacing=12,
expand=True,
scroll=ft.ScrollMode.AUTO,
alignment=ft.MainAxisAlignment.CENTER,
controls=[
showcase_card(stroke_join) for stroke_join in ft.StrokeJoin
],
),
],
),
)
)


if __name__ == "__main__":
ft.run(main)

Properties

BEVELclass-attributeinstance-attribute

Joins between line segments connect the corners of the butt ends of the line segments to give a beveled appearance.

MITERclass-attributeinstance-attribute

Joins between line segments form sharp corners.

ROUNDclass-attributeinstance-attribute

Joins between line segments are semi-circular.