当前位置:网站首页>Flet tutorial 07 basic introduction to popupmenubutton (tutorial includes source code)

Flet tutorial 07 basic introduction to popupmenubutton (tutorial includes source code)

2022-07-04 20:42: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? PopupMenuButton

 Please add a picture description

Icon button to display menu when clicked .

Combat code

import flet
from flet import Icon, Page, PopupMenuButton, PopupMenuItem, Row, Text, icons

def main(page: Page):
    def check_item_clicked(e):
        e.control.checked = not e.control.checked
        page.update()

    pb = PopupMenuButton(
        items=[
            PopupMenuItem(text="Item 1"),
            PopupMenuItem(icon=icons.POWER_INPUT, text="Check power"),
            PopupMenuItem(
                content=Row(
                    [
                        Icon(icons.HOURGLASS_TOP_OUTLINED),
                        Text("Item with a custom content"),
                    ]
       
原网站

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