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.41k stars 445 forks source link

'page.window_always_on_top = True' doesn't work #1910

Open beken0w opened 1 year ago

beken0w commented 1 year ago

'page.window_always_on_top = True' doesn't work

I found that if page doesn't have any object inside then 'page.window_always_on_top = True' doesn't work.

But if add for example ft.Text('text') inside page, it works.

It works


def main(page: ft.Page):

    # page.window_title_bar_hidden = True

    # page.window_title_bar_buttons_hidden = True

    page.window_width = 200

    page.window_height = 150

    page.window_resizable = True

    page.title = 'Pomodoro'

    page.scroll = 'auto'

    page.horizontal_alignment = 'center'

    page.window_center()

    page.window_always_on_top = True

    page.add(ft.Row([ft.Text('text')]))

if __name__ == '__main__':

    ft.app(target=main)

But this doesn't:

import flet as ft

def main(page: ft.Page):

    # page.window_title_bar_hidden = True

    # page.window_title_bar_buttons_hidden = True

    page.window_width = 200

    page.window_height = 150

    page.window_resizable = True

    page.title = 'Pomodoro'

    page.scroll = 'auto'

    page.horizontal_alignment = 'center'

    page.window_center()

    page.window_always_on_top = True

if __name__ == '__main__':

    ft.app(target=main)

Flet version (pip show flet):

Name: flet
Version: 0.10.3
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: d:\d\a_yandex_test_projects\venv\lib\site-packages
Requires: copier, flet-runtime, packaging, qrcode, watchdog, websocket-client, websockets
Required-by:

Operating system:

Windows 10

Additional environment details:

AlexanderMz commented 1 year ago

Hello @beken0w try put the line page.window_always_on_top = True at the beggining of the def that worked for me