当前位置:网站首页>Fleet tutorial 15 introduction to GridView Basics (tutorial includes source code)

Fleet tutorial 15 introduction to GridView Basics (tutorial includes source code)

2022-07-07 11:54:00 Knowledge fatness

Flet What is it?

Flet It's a framework , Make it easy for you to build real-time in your favorite language Web、 Mobile and desktop applications , And share them safely with your team . No front-end experience .

What is? GridView

Scrollable 2D control array .

Combat code

image.png

import flet
from flet import Image, Page, GridView, border_radius

def main(page: Page):
    page.title = "GridView Example"
    page.theme_mode = "dark"
    page.padding = 50
    page.update()

    images = GridView(
        expand=1,
        runs_count=5,
        max_extent=150,
        child_aspect_ratio=1.0,
        spacing=5,
        run_spacing=5,
    )

    page.add(images)

    for i in range(0, 60):
        images.controls.append(
            Image(
                src=f"https://picsum.photos/150/150?{i}",
                fit="none",
                repeat="noRepeat",
                border_radius=border_radius.all(10),
            )
        )
    page.update()

flet.app(target=main, view=flet.WEB_BROWSER)

原网站

版权声明
本文为[Knowledge fatness]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070945547083.html