Skip to content

Commit

Permalink
Update splash-test.py
Browse files Browse the repository at this point in the history
The "splash" property has been deprecated in recent versions of Flet. This patch updates the code to address this issue.

Additionally as per request (#165 (comment))  the bar is now stored in a variable, and we use page.overlay.remove(my_bar) to remove it
  • Loading branch information
non-npc authored Sep 12, 2024
1 parent c1b3710 commit a44cfe3
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions python/controls/page/splash-test.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
from time import sleep

import flet
import flet as ft
from flet import ElevatedButton, ProgressBar


def main(page):
def button_click(e):
page.splash = ProgressBar()
my_bar = ProgressBar()

page.overlay.append(my_bar)
btn.disabled = True
page.update()
sleep(3)
page.splash = None

page.overlay.remove(my_bar)
btn.disabled = False
page.update()

btn = ElevatedButton("Do some lengthy task!", on_click=button_click)

page.add(btn)


flet.app(target=main)
ft.app(target=main)

0 comments on commit a44cfe3

Please sign in to comment.