(Linux) Size of the window is not the one specified by window width and height when is set to not resizable
Description
Hello, i found out on Linux that when i set page.window_resizable to False the window is not resizable but the size of the window is not the one specified by page.window_width and page.window_height. The window is bigger than the specified size. I tested it on a MacOs machine and it works as expected. I emulated the bug on a VM with Ubuntu 22.04.1 LTS and Python 3.10.6 using UTM. I also tested it on a real machine with Ubuntu (same version) and i still get the same issue.
Code example to reproduce the issue:
import flet
from flet import IconButton, Page, Row, TextField, icons
def main(page: Page):
page.title = "Flet counter example"
page.vertical_alignment = "center"
# if i comment out the following line then the window has the correct size
page.window_resizable = False
page.window_width = 200
page.window_height = 200
txt_number = TextField(value="0", text_align="right", width=100)
def minus_click(e):
txt_number.value = int(txt_number.value) - 1
page.update()
def plus_click(e):
txt_number.value = int(txt_number.value) + 1
page.update()
page.add(
Row(
[
IconButton(icons.REMOVE, on_click=minus_click),
txt_number,
IconButton(icons.ADD, on_click=plus_click),
],
alignment="center",
)
)
flet.app(target=main)
Describe the results you received:
When page.window_resizable is set to False the window is not resizable but the size of the window is not the one specified by page.window_width and page.window_height. The window is bigger than the specified size.
https://user-images.githubusercontent.com/32139751/236680161-31730623-7472-4b31-b5fd-f782f6a3b828.mov
Describe the results you expected:
I expected when the window_resizable is set to False to have a window with the size specified by window_width and window_height that is not resizable.
Flet version (pip show flet):
Version: 0.5.2
Summary: Flet for Python - easily build interactive multi-platform apps in Python
Home-page:
Author: Appveyor Systems Inc.
Author-email: [email protected]
License: Apache-2.0
Location: /home/lucian/.local/lib/python3.10/site-packages
Requires: flet-core, httpx, oauthlib, packaging, watchdog, websocket-client, websockets
Required-by:
Operating system: Linux Ubuntu 22.04.1 LTS
Additional environment details: I emulated the bug on a VM with Ubuntu 22.04.1 LTS and Python 3.10.6 using UTM. I also tested it on a real machine with Ubuntu (same version) and i still get the same issue. I also tested it on a MacOs machine and it works as expected.
I am use Kubuntu 22.04.2. I encounte the same problem use your code .
There is info of my environment. Maybe it's helpful.
╰─>$ neofetch
`.:/ossyyyysso/:. theo@theo-kde
.:oyyyyyyyyyyyyyyyyyyo:` -------------
-oyyyyyyyodMMyyyyyyyysyyyyo- OS: Kubuntu 22.04.2 LTS x86_64
-syyyyyyyyyydMMyoyyyydmMMyyyyys- Host: 81YR Lenovo XiaoXin-15ARE 2020
oyyysdMysyyyydMMMMMMMMMMMMMyyyyyyyo Kernel: 5.15.0-70-generic
`oyyyydMMMMysyysoooooodMMMMyyyyyyyyyo` Uptime: 13 days, 4 hours, 51 mins
oyyyyyydMMMMyyyyyyyyyyyysdMMysssssyyyo Packages: 2950 (dpkg), 11 (snap)
-yyyyyyyydMysyyyyyyyyyyyyyysdMMMMMysyyy- Shell: fish 3.3.1
oyyyysoodMyyyyyyyyyyyyyyyyyyydMMMMysyyyo Resolution: 1920x1080
yyysdMMMMMyyyyyyyyyyyyyyyyyyysosyyyyyyyy DE: Plasma 5.24.7
yyysdMMMMMyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy WM: KWin
oyyyyysosdyyyyyyyyyyyyyyyyyyydMMMMysyyyo Theme: [Plasma], Breeze [GTK2/3]
-yyyyyyyydMysyyyyyyyyyyyyyysdMMMMMysyyy- Icons: [Plasma], breeze-dark [GTK2/3]
oyyyyyydMMMysyyyyyyyyyyysdMMyoyyyoyyyo Terminal: vscode
`oyyyydMMMysyyyoooooodMMMMyoyyyyyyyyo CPU: AMD Ryzen 5 4600U with Radeon Graphics (12) @ 2.100GHz
oyyysyyoyyyysdMMMMMMMMMMMyyyyyyyyo GPU: AMD ATI 03:00.0 Renoir
-syyyyyyyyydMMMysyyydMMMysyyyys- Memory: 11806MiB / 15356MiB
-oyyyyyyydMMyyyyyyysosyyyyo-
./oyyyyyyyyyyyyyyyyyyo/.
`.:/oosyyyysso/:.`
╰─>$ python --version
Python 3.10.6
╰─>$ pip show flet
Name: flet
Version: 0.6.2
Summary: Flet for Python - easily build interactive multi-platform apps in Python
Home-page:
Author: Appveyor Systems Inc.
Author-email: [email protected]
License: Apache-2.0
Location: /home/theo/playground/space/venv/lib/python3.10/site-packages
Requires: flet-core, httpx, oauthlib, packaging, watchdog, websocket-client, websockets
Required-by:
@FeodorFitsner any news on this ?
It works on windows as expected. Certainly/definitely a linux issue as you mentioned.
Is there any way to fix it or any idea on how to fix it ? I would love to do a PR for this project since i used it a lot for my personal projects.
I confirm that this is a problem on Linux Cinnamon also, still with flet 0.17.
Source code where I have the problem in this repo: https://gitlab.com/vindevoy/flet-fontawesome.git
Branch: bug/page.window_resizable File: tests/icons/main.py Line 53
I don't know if it is related to this, but when I close the application, I always get this error from GDK: (flet:740484): Gdk-CRITICAL **: 21:01:27.875: gdk_window_get_state: assertion 'GDK_IS_WINDOW (window)' failed
Does this bug exist in the latest Flet version?
pip install 'flet[all]' --upgrade
Is there any update on this? I am using Flet version 0.27.6 on Linux 12 bookworm. This issue is still there! It's working fine on Windows 11.
I am also experiencing this bug on Ubuntu 24.04.3 LTS with Flet version 0.28.3.
Additionally it doesn't seem like page.window.min_width, page.window.max_width, page.window.min_height or page.window.max_height has any effect on Linux since the window can be resized past these boundaries.
Can you please try the latest pre-release and let know if the issue still happens? Seems to be related to #1735
Closing in favor of #1735