简体   繁体   中英

How do I change the size of the Flet window on Windows or specify that it is not resizable?

In Flet on Windows, I'm running the calc demo and trying to modify properties of the application window in Python.

How do I change the size of the Flet window in code and specify that it should not be user resizable?

(Ideally this post should be tagged with 'Flet' but the tag doesn't exist yet as the project's in it's infancy and I don't have the 1500 points required to created it.)

To set the window's size and resizable:

def main(page: 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

The flet docs is very nice and easy to read. Please read the Page docs to learn more about "page".

You can use this as an example

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()


ft.app(target=main)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM