Open zrr1999 opened 1 year ago
I just made a notice that canvas shapes like Oval
, Circle
, Arc
... do not show/paint the dashes for an unknown reason. :(
Trying Line
on the other hand works/shows as expected.
Currently, dash pattern is supported in Line
and Path
only. You can achieve the same effect by using Path
shape:
import math
import flet as ft
def main(page: ft.Page):
page.add(
ft.canvas.Canvas(
[
ft.canvas.Path(
[
ft.canvas.Path.Oval(75, 75, 200, 200),
ft.canvas.Path.Arc(10, 10, 240, 240, 0, math.pi),
ft.canvas.Path.Arc(20, 20, 220, 220, 0, math.pi * 2),
],
paint=ft.Paint(
color=ft.colors.BLUE,
stroke_width=4,
stroke_dash_pattern=[2, 2],
style=ft.PaintingStyle.STROKE,
),
),
],
width=300,
height=300,
)
)
ft.app(target=main)
I'll leave this issue open to re-write other shapes to use Path.
You can achieve the same effect by using
Path
shap
thank you. I'll try this method
Description
stroke_dash_pattern
is not effectiveCode example to reproduce the issue:
Describe the results you received:
Describe the results you expected:
Additional information you deem important (e.g. issue happens only occasionally):
Flet version (
pip show flet
):Operating system: Windows
Additional environment details: