question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Page.window_destroy very slow

See original GitHub issue
import flet


def main(page: flet.Page):
    def quit_window(e):
        page.window_destroy()
    page.add(flet.TextButton(text='quit', on_click=quit_window))


flet.app(target=main)

It takes ~5 second to destory the window, frozen during that period. Is that possible to speed up that process?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
quan787commented, Sep 19, 2022

But what if, in the button’s on_click event callback, you try to hide the window first…then destroy it. Have you tried?

Yes and it works. My initial concern is it may slow down things in a loop. Then I realized I shouldn’t be coding that way, since only a single window is supported and I shouldn’t create and destroy it many times.

1reaction
quan787commented, Sep 15, 2022

No, sys.exit() doesn’t quit the script at all.

Also, the window may need to be reopened, by let’s say a system tray icon. Now I’m using page.window_visible to hide the window instead of destroying it as a more proper way, but it hurts the exiting speed nevertheless.

So maybe you can add hiding to the beginning of page.window_destroy() , and let it quit quietly?

Read more comments on GitHub >

github_iconTop Results From Across the Web

web page takes a long time to close when pressing close button
What is causing the long pause between when I press the close button (upper right), and the page actually closing?
Read more >
Web Pages Loading Slowly? 11 Fixes to Try in Windows 10
1. Check for Malware, Spyware and Viruses ... This step is pretty much a given. If something is loading slowly on a computer,...
Read more >
very slow closing of windows - Allround Automations forums
This behavior does not start immediately - if I open a window and close it inside of say 5, 10 minutes then it...
Read more >
web pages slow to close - Bleeping Computer
Hi when i click the red cross top right of web page it takes about 10 seconds to close . Im on windows...
Read more >
PC running slow? Here's how to speed things up - CNET
You don't need to throw the whole computer away. We'll walk you through some easy ways to get your PC back in shape....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found