36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""
|
|
ウインドウサイズテスト - 手法4: ft.run()オプション
|
|
"""
|
|
|
|
import flet as ft
|
|
|
|
def main(page: ft.Page):
|
|
# ウィンドウサイズ設定 - 手法4
|
|
page.title = "サイズテスト4"
|
|
|
|
# 基本的なプロパティ設定
|
|
page.window.width = 300
|
|
page.window.height = 500
|
|
|
|
# コンテンツ
|
|
page.add(
|
|
ft.Column([
|
|
ft.Text("手法4: ft.run()オプション", size=20, weight=ft.FontWeight.BOLD),
|
|
ft.Text("ft.run()のviewオプションを使用"),
|
|
ft.ElevatedButton("テストボタン", on_click=lambda _: print("クリックされました")),
|
|
ft.Container(
|
|
content=ft.Text("コンテナテスト", color=ft.Colors.WHITE),
|
|
bgcolor=ft.Colors.PURPLE,
|
|
padding=20,
|
|
width=200,
|
|
height=100
|
|
)
|
|
], spacing=10)
|
|
)
|
|
|
|
if __name__ == "__main__":
|
|
# ft.run()のオプションでウィンドウサイズを指定
|
|
ft.run(
|
|
main,
|
|
view=ft.AppView.WEB_BROWSER
|
|
)
|