h-1.flet.3/test_size_3.py
2026-02-20 23:24:01 +09:00

39 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
ウインドウサイズテスト - 手法3: page.windowプロパティ修正版
"""
import flet as ft
def main(page: ft.Page):
# ウィンドウサイズ設定 - 手法3修正版
page.title = "サイズテスト3"
# page.windowプロパティを個別に設定
page.window.width = 300
page.window.height = 500
page.window.min_width = 250
page.window.min_height = 400
page.window.max_width = 400
page.window.max_height = 600
page.window.resizable = True
# 中央配置はpage.window_centerを使用
page.window_center = True
# コンテンツ
page.add(
ft.Column([
ft.Text("手法3: page.windowプロパティ修正版", size=20, weight=ft.FontWeight.BOLD),
ft.Text("page.window.width/heightを個別設定"),
ft.ElevatedButton("テストボタン", on_click=lambda _: print("クリックされました")),
ft.Container(
content=ft.Text("コンテナテスト", color=ft.Colors.WHITE),
bgcolor=ft.Colors.RED,
padding=20,
width=200,
height=100
)
], spacing=10)
)
if __name__ == "__main__":
ft.run(main)