Skip to content

bug: Window height inconsistent between platforms #5749

@Alex25820

Description

@Alex25820

Duplicate Check

Describe the bug

On Windows the window height includes the applications title bar whilst on Linux it dose not.

For example setting a window to be 32 pixels tall on Linux gives a window that is 32 pixels tall + the height of the title bar. On windows setting a window to be 32 pixels tall only renders the title bar since 32 pixels is less than the height of the title bar. (The title bar appears to be 38 pixels tall on Windows 11.)

Setting the height of a window is therefore inconsistent and produces different results on different platforms.

I am unaware of how the height behaves on macOS.

Code sample

Code
page.window.height = 50

To reproduce

  1. Set the window height (preferably to something small like 50px since it is easier to see the issue with a short height).
  2. Run the application on Windows and Linux.
  3. Observe the difference in window height on the two platforms.

Expected behavior

The height of the title bar is excluded from the window height on Windows like it is on Linux.

Screenshots / Videos

No response

Operating System

Windows

Operating system details

Windows 11 (Also tested on Ubuntu 24.04.3 LTS)

Flet version

0.28.3

Regression

I'm not sure / I don't know

Suggestions

For anyone else facing this problem you can use the function below when changing window height to compensate:

def UpdateWindowHeight(page: ft.Page, height: int) -> None:
    if page.platform == ft.PagePlatform.WINDOWS:
        height += 38
    page.window.height = height

Logs

No response

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions