flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.05k stars 427 forks source link

ft.app(main,view=ft.AppView.FLET_APP_HIDDEN) Doesn't work #3223

Closed vitaluska123 closed 2 months ago

vitaluska123 commented 5 months ago

Description

Code example to reproduce the issue:

ft.app(main,view=ft.AppView.FLET_APP_HIDDEN)

Describe the results you received: the window is visible when i start app (include build and run)

Describe the results you expected: When programm start window hiden

Additional information you deem important (e.g. issue happens only occasionally): NONE

Flet version (pip show flet):

Name: flet
Version: 0.22.0
Summary: Flet for Python - easily build interactive multi-platform apps in Python
Home-page:
Author: Appveyor Systems Inc.
Author-email: hello@flet.dev
License: Apache-2.0
Location: C:\Users\Strunder\AppData\Local\Programs\Python\Python312\Lib\site-packages
Requires: cookiecutter, fastapi, flet-runtime, packaging, qrcode, uvicorn, watchdog
Required-by: flet-fastapi

Give your requirements.txt file (don't pip freeze, instead give direct packages):

flet

Operating system:

Additional environment details: Default (flet create)

FeodorFitsner commented 5 months ago

Thanks!

Could you provide a sample app to reproduce the issue too?

vitaluska123 commented 5 months ago

Thanks!

Could you provide a sample app to reproduce the issue too?

import flet as ft

def main(page: ft.Page):
    page.add(ft.SafeArea(ft.Text("Hello, Flet!")))

ft.app(main,view=ft.AppView.FLET_APP_HIDDEN)
FeodorFitsner commented 5 months ago

This example doesn't work on macOS as well:

from time import sleep

import flet as ft

def main(page: ft.Page):

    page.add(
        ft.Text("Hello!")
    )

    sleep(3)
    page.window_visible = True
    page.update()  

ft.app(target=main, view=ft.AppView.FLET_APP_HIDDEN)

Looks like a bug.

hanyce commented 2 months ago

Any update on this issue?

ndonkoHenri commented 2 months ago

Closing this issue in favor of #2705

feb-cloud commented 1 month ago

@FeodorFitsner @ndonkoHenri

The environment I tested: Python 3.8.13 Windows-10-10.0.19045-SP0

Flet versions tested: every release from 0.23.2 - 0.15.0.

Test code:

from time import sleep

import flet as ft

def main(page: ft.Page):
page.add(ft.Text("Hello!"))

sleep(3)

page.window_visible = True
page.update()

ft.app(main, view=ft.AppView.FLET_APP_HIDDEN)

Conclusion: view=ft.AppView.FLET_APP_HIDDEN has been invalid since 0.16.0, but it is valid in 0.15.0.

I tested another version to be released, 0.24.0.dev3317, and the problem still exists.