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.44k stars 446 forks source link

Window visibility not working as expected with `FLET_APP_HIDDEN` #2705

Open Camreishi opened 8 months ago

Camreishi commented 8 months ago

Description

I am encountering an issue when trying to implement the code documented in the Flet.dev documentation regarding controlling window visibility (referencing the section at https://flet.dev/docs/controls/page/#window_visible). Specifically, I'm experimenting with the view=ft.AppView.FLET_APP_HIDDEN option to hide the application window as described.

However, it appears that this feature is not functioning as expected in recent versions of the Flet library (including but not limited to version 0.20.2). Upon applying FLET_APP_HIDDEN, the window does not get hidden as documented.

Code example to reproduce the issue:

from time import sleep

import flet as ft

def main(page: ft.Page):
    print("Starting the process...")
    page.add(
        ft.Text("Hello!")
    )

    sleep(3)
    print("Waking up from sleep...")
    page.window_visible = True
    page.update()

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

Describe the results you received:

The window appears immediately upon program execution and does not get hidden during that period.

Describe the results you expected:

The program starts with a hidden window and makes it visible in 3 seconds.

Additional information you deem important (e.g. issue happens only occasionally): This feature functions as intended on another computer running Flet version 0.10.

Flet version (pip show flet):

flet 0.20.2

Operating system:

Windows 11 22H2

Please let me know if you need any more details or have suggestions for further troubleshooting steps. Thank you!

karlz97 commented 7 months ago

Same problem here.

ositoMalvado commented 5 months ago

Same problem! Any solution?

ndonkoHenri commented 5 months ago

@ositoMalvado, it will be nice if you could provide more information (Flet version, OS, etc).

ositoMalvado commented 5 months ago

@ositoMalvado, it will be nice if you could provide more information (Flet version, OS, etc).

Sorry I have forgotten.

Flet 0.22.1 Python 3.11.9 Microsoft Windows 10.0.22631.3593

Bronya0 commented 5 months ago

+1

WagmanK commented 5 months ago

Same problem

Python 3.12.1 Flet 0.22.1 Windows 10 Pro 22H2

Kexi8BiT commented 5 months ago

Same problem =)

Python 3.12.2 Flet 0.22.1 Windows 11 Pro 24H2

and even with this code, the window is visible)

import flet as ft
def main(page: ft.Page):
    page.add(ft.Text("hello world"))
ft.app(main, view=ft.FLET_APP_HIDDEN)
Tempmail1234-pass commented 4 months ago

Same problem

Python 3.10.13 Flet 0.23.1 Windows 10

hanyce commented 4 months ago

Any update on this issue?

non-npc commented 2 months ago

If I may propose a temporary solution to the window visibility bug. Could we set the window to minimized as the invisible state and if it is not minimized then it is in the visible state ?

yst-one commented 1 month ago

Python 3.12.2 Flet 0.24.1 Windows 11 专业版 24H2