flet icon indicating copy to clipboard operation
flet copied to clipboard

Window visibility not working as expected with `FLET_APP_HIDDEN`

Open Camreishi opened this issue 1 year ago • 11 comments

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!

Camreishi avatar Feb 21 '24 06:02 Camreishi

Same problem here.

karlz97 avatar Apr 04 '24 21:04 karlz97

Same problem! Any solution?

ositoMalvado avatar May 21 '24 21:05 ositoMalvado

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

ndonkoHenri avatar May 22 '24 00:05 ndonkoHenri

@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

ositoMalvado avatar May 22 '24 01:05 ositoMalvado

+1

Bronya0 avatar May 28 '24 03:05 Bronya0

Same problem

Python 3.12.1 Flet 0.22.1 Windows 10 Pro 22H2

WagmanK avatar Jun 15 '24 16:06 WagmanK

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)

Kexi8BiT avatar Jun 16 '24 10:06 Kexi8BiT

Same problem

Python 3.10.13 Flet 0.23.1 Windows 10

Tempmail1234-pass avatar Jun 20 '24 15:06 Tempmail1234-pass

Any update on this issue?

hanyce avatar Jul 10 '24 06:07 hanyce

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 ?

non-npc avatar Sep 12 '24 19:09 non-npc