Skip to content

bug: While using flet run, the window starts flashing continuously after few minutes of testing changes. #6913

Description

@htanwar922

Duplicate Check

Describe the bug

Please refer the screenshots/video section below. The video shows the flashing behavior I have experienced. I have uploaded a zip file and pasted a diff of changes I was making one-by-one while saving regularly, when the issue re-surfaced. I have experienced the same behavior with flet run in another project I developed, and on a different machine, so it is not an individual instance.

Note: The flashing does not start immediately; it starts randomly after few minutes of making changes. The video was made after the flashing started.

PS V:\Workspace\System-Simulator> [System.Environment]::OSVersion

Platform ServicePack Version      VersionString
-------- ----------- -------      -------------
 Win32NT             10.0.22631.0 Microsoft Windows NT 10.0.22631.0

PS V:\Workspace\System-Simulator> pwsh --version
PowerShell 7.6.1
PS V:\Workspace\System-Simulator> python --version
Python 3.14.5
PS V:\Workspace\System-Simulator> pip show flet
Name: flet
Version: 1.0.3
Summary: Flet for Python - easily build interactive multi-platform apps in Python
Home-page: https://flet.dev
Author:
Author-email: "Appveyor Systems Inc." <hello@flet.dev>
License-Expression: Apache-2.0
Location: C:\Users\Himanshu.H\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages
Requires: httpx, msgpack, oauthlib, repath
Required-by: flet-cli, flet-desktop, flet-web
flet run -d -r --ignore-dirs "$((Get-Content .\.gitignore) -join ',')" .\bench_gui.py

Code sample

Code

battery-system-simulator.zip
The zip file contains the complete code that I have tested with. I made the following changes by hand one by one and saving in batches when I experienced this.

PS V:\Workspace\System-Simulator> git diff
diff --git a/.gitignore b/.gitignore
index 015e55e..073c487 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,4 @@
 __pycache__/**
 .deltallm/**
 docs/plans/**
-_circuit_preview.png
-_prev_*.png
-
+.ignore/**
diff --git a/circuit_canvas.py b/circuit_canvas.py
index 98a46f6..d2ffda2 100644
--- a/circuit_canvas.py
+++ b/circuit_canvas.py
@@ -63,9 +63,9 @@ class Layout:
     S3_Y_TOP: float = 135.0
     S3_Y_BOT: float = 180.0
     # battery box
-    BATT_CY: float = 270.0
-    BATT_W: float = 180.0
-    BATT_H: float = 100.0
+    BATT_CY: float = 300.0
+    BATT_W: float = 100.0
+    BATT_H: float = 150.0
     # labels
     SRC_LBL_X: float = 320.0
     SRC_LBL_Y: float = 300.0
@@ -74,18 +74,18 @@ class Layout:
     # current arrows + labels
     SRC_ARROW_LEAD_Y: float = 150.0
     SRC_ARROW_RET_Y: float = 350.0
-    SRC_ARROW_LBL_DY: float = 34.0
+    SRC_ARROW_LBL_DY: float = 60.0
     SRC_RAIL_ARROW_X: float = 470.0
     LOAD_ARROW_LEAD_Y: float = 150.0
     LOAD_ARROW_RET_Y: float = 350.0
-    LOAD_ARROW_LBL_DY: float = -34.0
+    LOAD_ARROW_LBL_DY: float = -60.0
     LOAD_RAIL_ARROW_X: float = 660.0
     BAT_ARROW_TOP_Y: float = 112.0
     BAT_ARROW_MID_Y: float = 200.0
-    BAT_ARROW_BOT_Y: float = 370.0
-    BAT_ARROW_LBL_DY: float = 40.0
+    BAT_ARROW_BOT_Y: float = 390.0
+    BAT_ARROW_LBL_DY: float = 60.0
     # node A label (offset above the top rail)
-    NODE_LBL_DY: float = -44.0
+    NODE_LBL_DY: float = -30.0


 LAYOUT = Layout()
@@ -369,16 +369,19 @@ def _battery_branch(s, view=None):
     top = cy - L.BATT_H / 2
     bot = cy + L.BATT_H / 2
     out = []
+
     # wires: node A -> S3 (top), S3 -> box top, box(-) -> ground
     out.append(_line(L.X_BAT, L.Y_TOP, L.X_BAT, L.S3_Y_TOP, on, view=view))
     out.append(_line(L.X_BAT, L.S3_Y_BOT, L.X_BAT, top, on, view=view))
     out.append(_line(L.X_BAT, bot, L.X_BAT, L.Y_BOT, on, view=view))
+
     out.append(_rect(cx - L.BATT_W / 2, top, L.BATT_W, L.BATT_H, col, 2.4,
                      view=view))
-    out.append(_text(cx, top + 14, "+", 15, col, ft.FontWeight.BOLD,
+    out.append(_text(cx, top + 10, "+", 15, col, ft.FontWeight.BOLD,
                      view=view))
-    out.append(_text(cx, bot - 12, "−", 15, col, ft.FontWeight.BOLD,
+    out.append(_text(cx, bot - 10, "−", 15, col, ft.FontWeight.BOLD,
                      view=view))
+
     # SOC bar
     soc = max(0.0, min(100.0, s.soc_pct))
     bar_w = L.BATT_W - 60
@@ -388,7 +391,7 @@ def _battery_branch(s, view=None):
         fill_col = C_GREEN if soc > 20 else (C_AMBER if soc > 10 else C_RED)
         out.append(_fill_rect(cx - bar_w / 2, cy - 8, bar_w * soc / 100.0,
                               14, fill_col, view=view))
-    out.append(_text(cx, cy - 22, f"BATTERY  {s.num_cells}S "
+    out.append(_text(cx, top + 35, f"BATTERY\n{s.num_cells}S "
                                    f"{s.capacity_ah:g} Ah", 15, C_TEXT,
                      ft.FontWeight.BOLD, view=view))
     out.append(_text(cx, cy + 30, f"SOC {soc:.0f}%  SOH {s.soh_pct:g}%",
@@ -443,7 +446,7 @@ def _current_arrows(s, view=None):
                           view=view))
         out.append(_arrow(L.X_SRC, L.SRC_ARROW_RET_Y, 0, -1 if up else 1, c,
                           view=view))
-        out.append(_text(L.X_SRC + 34, L.SRC_ARROW_LEAD_Y,
+        out.append(_text(L.X_SRC + L.SRC_ARROW_LBL_DY, L.SRC_ARROW_LEAD_Y,
                          f"I = {abs(s.i_source):.1f} A", 20, c,
                          ft.FontWeight.BOLD, view=view))
     if abs(s.i_load) > 1e-9:
@@ -455,7 +458,7 @@ def _current_arrows(s, view=None):
                           view=view))
         out.append(_arrow(L.X_LOAD, L.LOAD_ARROW_RET_Y, 0, 1 if dn else -1, c,
                           view=view))
-        out.append(_text(L.X_LOAD - 34, L.LOAD_ARROW_LEAD_Y,
+        out.append(_text(L.X_LOAD + L.LOAD_ARROW_LBL_DY, L.LOAD_ARROW_LEAD_Y,
                          f"I = {abs(s.i_load):.1f} A", 20, c,
                          ft.FontWeight.BOLD, view=view))
     if abs(s.i_battery) > 1e-9:

To reproduce

  1. Run the repo code with flet run -d -r --ignore-dirs "$((Get-Content .\.gitignore) -join ',')" .\bench_gui.py (without .gitignore if none is there).
  2. Make the diff changes one-by-one saving regularly.

Expected behavior

Please refer the videos for the bug demo.

Screenshots / Videos

Captures

Both videos are from my current project. The first one is the first time I tested and observed the flashing in this project. The second one starts from the beginning of running the command in PowerShell and has verbose logs as well at the end. The logs are copied in the logs section.

Screen.Recording.2026-10-04.151111.mp4
bug.mp4

Operating System

Windows

Operating system details

Microsoft Windows NT 10.0.22631.0

Flet version

1.0.3

Regression

Yes, it used to work in a previous Flet version (please specify the version in additional details)

Suggestions

The hot-reload session seems to be getting killed out. Start there.

PS: Good Work!!

Logs

Logs
PS V:\Workspace\System-Simulator> flet run -d -r --ignore-dirs "$((cat .\.gitignore) -join ',')" .\bench_gui.py --verbose
INFO:flet:Starting up TCP server on localhost:54553
INFO:flet:Flet app has started...
INFO:flet_desktop:Starting Flet View app...
INFO:flet_desktop:Flet client found in cache: C:\Users\Himanshu.H\.flet\client\flet-desktop-full-1.0.3
INFO:flet:App session started
INFO:flet:Starting up TCP server on localhost:54553
INFO:flet:Flet app has started...
INFO:flet:App session started
INFO:flet:Starting up TCP server on localhost:54553
INFO:flet:Flet app has started...
INFO:flet:App session started
INFO:flet:Starting up TCP server on localhost:54553
INFO:flet:Flet app has started...
INFO:flet:App session started
INFO:flet:Starting up TCP server on localhost:54553
INFO:flet:Flet app has started...
INFO:flet:App session started
INFO:flet:Starting up TCP server on localhost:54553
INFO:flet:Flet app has started...
INFO:flet:App session started
INFO:flet:Starting up TCP server on localhost:54553
INFO:flet:Flet app has started...
INFO:flet:App session started
INFO:flet:Starting up TCP server on localhost:54553
INFO:flet:Flet app has started...
INFO:flet:App session started
INFO:flet:Starting up TCP server on localhost:54553
INFO:flet:Flet app has started...
INFO:flet:App session started
INFO:flet:Starting up TCP server on localhost:54553
INFO:flet:Flet app has started...
INFO:flet:App session started
INFO:flet:Starting up TCP server on localhost:54553
INFO:flet:Flet app has started...
INFO:flet:App session started
INFO:flet:Session was garbage collected: z4Wsx2KgWV9nDTUK
INFO:flet:Session was garbage collected: O4X0CGAZD3E4lrE1
INFO:flet:App session started
INFO:flet:Session was garbage collected: R6LPb2yuarYTsWhE
INFO:flet:App session started
INFO:flet:Session was garbage collected: nGat4lk9ojPVe9LA
INFO:flet:App session started
INFO:flet:Session was garbage collected: QKhcrDEsped4d5A5
INFO:flet:App session started
INFO:flet:Session was garbage collected: 3HQklXeEAZSLw95y
INFO:flet:App session started
INFO:flet:Session was garbage collected: 1yXSdAOGXXpoGJuz
INFO:flet:App session started
INFO:flet:Session was garbage collected: rrZ18cH7l1X8yzDS
INFO:flet:App session started
INFO:flet:Session was garbage collected: lhb2ptFEyypuQ5H1
INFO:flet:App session started
INFO:flet:Session was garbage collected: 5K53UPUVgKhNeqKs
INFO:flet:App session started
INFO:flet:Session was garbage collected: S1EKeEb2tVV2nN92
INFO:flet:App session started
INFO:flet:Session was garbage collected: nfcovVrWV4ciwSO2
INFO:flet:App session started
INFO:flet:Session was garbage collected: JA7W5FZpciJYpQtC
INFO:flet:App session started
INFO:flet:Session was garbage collected: LjUVEJd9Ilp4zaED
INFO:flet:App session started
INFO:flet:Session was garbage collected: NZ5Es2NU8cGxu6fq
INFO:flet:App session started
INFO:flet:Session was garbage collected: exiVtLbHNntPWI8i
INFO:flet:App session started
INFO:flet:Session was garbage collected: wtzPtYiXZ6ai84Xz
INFO:flet:App session started
INFO:flet:Session was garbage collected: MvUsnvbHcdKH1eG0
INFO:flet:App session started
INFO:flet:Session was garbage collected: fIYqyhnzgQwYO5sQ
INFO:flet:App session started
INFO:flet:Session was garbage collected: hpqNi0fbqjbSZSaL
INFO:flet:App session started
INFO:flet:Session was garbage collected: 2r3xa8ujXtvIQVOP
INFO:flet:App session started
INFO:flet:Session was garbage collected: xxVfjnzgcr94D5yx
INFO:flet:App session started
INFO:flet:Session was garbage collected: cee3xOVy8jhpWwOY
INFO:flet:App session started
INFO:flet:Session was garbage collected: PWw8sYx1pBmOg3Ms
INFO:flet:App session started
INFO:flet:Session was garbage collected: X57fQYZGIiaXQo28
INFO:flet:App session started
INFO:flet:Session was garbage collected: s7ljxBiDSVeMHRxx
INFO:flet:App session started
INFO:flet:Session was garbage collected: 3PI1fk8syKsS0v28
INFO:flet:App session started
INFO:flet:Session was garbage collected: clCdxSG1fQg4rq8j
INFO:flet:App session started
INFO:flet:Session was garbage collected: Fp4BG0a7YQ6yfHoA
INFO:flet:App session started
INFO:flet:Session was garbage collected: Ch9NmbT5VX7XsSFL
INFO:flet:App session started
INFO:flet:Session was garbage collected: PfN4Crpplvl80Rwg
INFO:flet:App session started
INFO:flet:Session was garbage collected: KHQiykcSdVAGRZz6
INFO:flet:App session started
INFO:flet:Session was garbage collected: Oai5esGwpfGp1t8z
INFO:flet:App session started
INFO:flet:Session was garbage collected: oJG16MKaVmLZwxjN
INFO:flet:App session started
INFO:flet:Session was garbage collected: gUkwNn6cBPHVcGXV
INFO:flet:App session started
INFO:flet:Session was garbage collected: aP6Y0QAaBZYxwX6h
INFO:flet:App session started
...

Additional details

Flet previously used: 0.85.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions