flet
flet copied to clipboard
Window_maximized, window_minimized, window_close (), there is a very obvious delay after triggering the event.
I do maximize, minimize, close events through custom controls, and trigger the response through page.update (), but it always feels like a delay of about 0.5 seconds after clicking, not as quickly as the native maximize, minimize, and close. This is my control click event function.
# For example: this is a minimized custom control binding event
Container(content=IconButton(icons.REMOVE_CIRCLE_OUTLINE, on_click=set_window_minimized), alignment=alignment.center)
# This is event logic.
def set_window_minimized(e):
if page.window_minimized is False:
page.window_minimized = True
page.update()
I hope to hear from you. My computer environment is Windows 10 Professional 21H2. @FeodorFitsner
Flet is server driven. the delay may be from that latency generally speaking though my latency is usually 0.1 sec. 0.5 seems like a lot
Flet is server driven. the delay may be from that latency generally speaking though my latency is usually 0.1 sec. 0.5 seems like a lot
Thank you for your reply. The problem is that it doesn't feel very smooth. I am currently studying how to achieve the built-in effect of the system, but I still need some time to study and solve it while learning Flet development. I hope you have a good plan, you can share.
For me single page.window_minimized=True haven't work at all (Windows 10) But this code fixed it (Maybe some better solutions exist)
def minimizeWindow(e):
controls = page.controls
page.controls = []
page.window_minimized = True
page.update()
page.controls = controls
page.update()
@dodiko1d have a look at the code below:
import flet as ft
def main(page: ft.Page):
def minimizeWindow(e):
page.window_minimized = True
page.update()
page.add(ft.ElevatedButton("Minimize This Window", on_click=minimizeWindow))
ft.app(target=main)
After setting the property to True, simply call the update and that's it. :)
@dodiko1d have a look at the code below:
import flet as ft def main(page: ft.Page): def minimizeWindow(e): page.window_minimized = True page.update() page.add(ft.ElevatedButton("Minimize This Window", on_click=minimizeWindow)) ft.app(target=main)After setting the property to True, simply call the update and that's it. :)
Yeah, already tried, on my PC works worse, missing 25-40% clicks. Maybe something wrong with layout, will try to check next time.
i tried it many times, and i found that if i put the button(connected to min/max event) into a WindowDragArea(as a property), it would have a long delay, but the buttons in normal containers dont
Please guys, move to the latest flet version, retry, and report if or not these issues are still present.