Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 359
Crapicus Avatar asked Oct 13 '25 03:10

Crapicus


2 Answers

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)
like image 137
Dhiaelhak_salhi Avatar answered Oct 14 '25 19:10

Dhiaelhak_salhi


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".

like image 20
LimJ Avatar answered Oct 14 '25 18:10

LimJ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!