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.18k stars 429 forks source link

`window_min_height` doesn't work when `window_title_bar_hidden` is set #1735

Open hyx0329 opened 1 year ago

hyx0329 commented 1 year ago

Description

I would like to make a customized frameless window. The window has a minimum size requirement for elements to be shown properly. I found that when window_title_bar_hidden is set, neither window_min_height nor window_min_width is effective.

Code example to reproduce the issue:

import flet as ft

def entry(page: ft.Page):
    content = ft.Text("Hello world!")
    page.add(content)

    page.window_title_bar_hidden = True
    page.window_min_height = 600
    page.window_min_width = 800

    page.update()

ft.app(target=entry)

Describe the results you received:

The window can be resized to any arbitrary size.

Describe the results you expected:

The window shouldn't be smaller when limits are hit.

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

Async runtime is also affected.

Flet version (pip show flet):

Name: flet
Version: 0.9.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: /path/to/project/.venv/lib/python3.11/site-packages
Requires: copier, flet-runtime, packaging, pydantic, qrcode, watchdog, websocket-client, websockets
Required-by:

Operating system:

ArchLinux

Additional environment details:

ndonkoHenri commented 1 year ago

The minimum dimensions are respected on my end. Add the code line below to better observe the window behavior.

page.on_resize = lambda e: print(page.window_width, page.window_height)

A video capture with the app's window on one side and the printed values on the other could be useful.

hyx0329 commented 1 year ago

Sure, here is the capture recorded on GNOME(X11) with OBS.

https://github.com/flet-dev/flet/assets/11469710/bb6e977c-be41-40a9-95df-8144a26fd7c0

ndonkoHenri commented 1 year ago

Yup! There is definitely an issue, and it's certainly OS-specific.