examples icon indicating copy to clipboard operation
examples copied to clipboard

Update splash-test.py

Open non-npc opened this issue 1 year ago • 3 comments

The "splash" property has been deprecated in recent versions of Flet. This patch updates the code to address this issue.

non-npc avatar Sep 12 '24 17:09 non-npc

Wouldn't it be nice to store the bar in a variable, then use page.overlay.remove(my_bar) to remove it? What do you think?

ndonkoHenri avatar Sep 12 '24 17:09 ndonkoHenri

store the bar in a variable, then use page.overlay.remove(my_bar) to remove it

absolutely, fantastic idea!

Here is the updated code, let me know if you approve and I will apply the changes.

`from time import sleep import flet from flet import ElevatedButton, ProgressBar

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

    btn.disabled = True
    page.update()
    sleep(3)

    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) `

non-npc avatar Sep 12 '24 17:09 non-npc

Looks good to me.

ndonkoHenri avatar Sep 12 '24 18:09 ndonkoHenri