Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: page.window_width and page.window_height is not always working #1651

Open
moonlitgrace opened this issue Jul 28, 2023 · 7 comments
Open

Comments

@moonlitgrace
Copy link

Description
I configured width and height for page window. And when I run code, it may show window with correct size and if I re run again then shows a window with different size ( probably my screen size ). And this happens all the time which feels off.

Code example to reproduce the issue:

import flet as ft

def main(page: ft.Page):
    page.theme_mode = ft.ThemeMode.LIGHT
    page.window_width = 330
    page.window_height = 660
    # configure custom fonts
    page.fonts = {
        "Poppins": "fonts/Poppins/Poppins-regular.ttf",
        "Fontspring": "fonts/Fontspring/Fontspring-regular.otf",
    }

    page.add(ft.Text("Instagram", font_family="Fontspring"))

if __name__ == "__main__":
    ft.app(target=main, assets_dir="assets")

Describe the results you received:
Some times shows correct window size, some times not.

Describe the results you expected:
Show page window with configured size

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

Flet version (pip show flet):

Name: flet
Version: 0.8.4
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: /home/sssuneeth/Desktop/instagram-app/flet_env/lib/python3.10/site-packages
Requires: copier, flet-runtime, packaging, pydantic, qrcode, watchdog, websocket-client, websockets
Required-by:

Operating system:
Linux

Additional environment details:
...

@ndonkoHenri
Copy link
Collaborator

Please can you provide a screen capture/shot of what you mean?

@moonlitgrace
Copy link
Author

I think this would be enough?

Screencast.from.2023-07-29.07-51-50.webm

@ndonkoHenri
Copy link
Collaborator

Can you try with the latest flet version? v0.9.0

@gabChouin
Copy link

Can you try with the latest flet version? v0.9.0

Hi, I just got the same behavior with the current version of flet (v.0.9.0). I noticed it only happens when I set page.window_resizable = False.

Here's an easy demo I use to test it:

import flet as ft

def main(page: ft.Page):   
    page.window_width = 200        # window's width is 200 px
    page.window_height = 200       # window's height is 200 px
    page.window_resizable = False  # window is not resizable
    page.update()

    # add/update controls on Page
    t = ft.Text(value="Hello, world!", color="green", font_family="Museo Sans 300")
    page.controls.append(t)
    page.update()

ft.app(target=main)

if you comment the line page.window_resizable = False # window is not resizable it starts working.

@ndonkoHenri
Copy link
Collaborator

ndonkoHenri commented Aug 15, 2023

It works as expected on my end. I tried several times, and not even once did it have another size.
Can you try the below and share the app's behavior?

import flet as ft


def main(page: ft.Page):
    page.window_width = 200  # window's width is 200 px
    page.window_height = 200  # window's height is 200 px
    page.window_visible = True
    page.window_resizable = False  # window is not resizable
    page.update()

    # add/update controls on Page
    t = ft.Text(value="Hello, world!", color="green", font_family="Museo Sans 300")
    page.controls.append(t)
    page.update()


ft.app(target=main, view=ft.FLET_APP_HIDDEN)

@moonlitgrace
Copy link
Author

Hi, I just got the same behavior with the current version of flet (v.0.9.0). I noticed it only happens when I set page.window_resizable = False.

Yes, recently I updated to version v0.9.0 pip install flet --upgrade, now this issue seems almost okay ( but still acting weird some times ).
and if I set page.window_resizable = False then shows another window size... same here.

It works as expected on my end. I tried several times, and not even once did it have another size.
Can you try the below and share the app's behavior?

Okay! try for 10 times? but still its not stable on my end. Also I did tried your test code, same since it has page.window_resizable = False. If I remove or comment it... back to normal ( with issue some times ).

@moonlitgrace
Copy link
Author

Okay, any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants