flet icon indicating copy to clipboard operation
flet copied to clipboard

destroy() and close() methods for page.window are not exiting the app after 0.26 once the apk done.

Open SIRGPrice opened this issue 1 year ago • 3 comments

Duplicate Check

  • [x] I have searched the opened issues and there are no duplicates

Describe the bug

I just updated my flet to 0.26 because I need its new features, however, now, the page.window.destroy () method no longer works, I can't find a way to close the app. I have also tried page.window.close () and to give it time.sleep (0.1) before and after and to modify and remove the views before closing and nothing. My method is typical, give the icon to turn off and let out an alert dialog where one of the answers throws a lambda containing the page.window.destroy (). But I just chose the option and nothing happens, neither does the app break or there is any consequence. Nothing just happens. If I put the page.window.destroy() in ANY other part of the code same happends.

In my computer it works fine, its only once apk done when it does not exit.

Any ideas?

Code sample

Code
page.window.destroy()

To reproduce

page.window.destroy()

Expected behavior

line x: page.window.destroy() => exiting the app

Screenshots / Videos

Captures

[Upload media here]

Operating System

Windows

Operating system details

Windows 11

Flet version

0.26.0

Regression

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

Suggestions

No response

Logs

Logs
No logs at all

Additional details

Used to work in flet 0.24 but not always.

Im using poetry and the custom flet numpy.

SIRGPrice avatar Jan 31 '25 14:01 SIRGPrice

Page.window.destroy() only works on desktop platforms.

On mobile especially on Android you can try using the os.exit_(0) binded to the detach event.

HappyCoder256 avatar Jan 31 '25 21:01 HappyCoder256

It works just perfect, without more complications. Thanks mate. 😄

SIRGPrice avatar Jan 31 '25 22:01 SIRGPrice

I think someone should post this in the docs with a note next to destroy and close methods to specify the exit methods depending on the os. Thanks for all.

@FeodorFitsner

SIRGPrice avatar Jan 31 '25 22:01 SIRGPrice