当前位置:网站首页>Flet教程之 05 OutlinedButton基础入门(教程含源码)
Flet教程之 05 OutlinedButton基础入门(教程含源码)
2022-07-04 18:49:00 【知识大胖】
什么是OutlinedButton
轮廓按钮是中等强调按钮。它们包含重要的操作,但不是应用程序中的主要操作。轮廓按钮与填充按钮很好地配对,以指示替代的次要操作。
实战代码
import flet
from flet import OutlinedButton, Page
def main(page: Page):
page.title = "Basic outlined buttons"
page.add(
OutlinedButton(text="Outlined button"),
OutlinedButton("Disabled button", disabled=True),
)
flet.app(target=main)
带图的button
import flet
from flet import OutlinedButton, Page
def main(page: Page):
page.title = "Outlined buttons with icons"
page.add(
OutlinedButton("Button with icon", icon="chair_outlined"),
OutlinedButton(
"Button with colorful icon",
icon="park_rounded",
icon_color="green400",
),
)
flet.app(target=main)
响应点击
import flet
from flet import OutlinedButton, Page, Text
def main(page: Page):
page.title = "Outlined button with 'click' event"
def button_clicked(e):
b.data += 1
t.value = f"Button clicked {b.data} time(s)"
page.update()
b = OutlinedButton("Button with 'click' event", on_click=button_clicked, data=0)
t = Text()
page.add(b, t)
flet.app(target=main)
自定义按钮
import flet
from flet import (
Column,
Container,
Icon,
OutlinedButton,
Page,
Row,
Text,
icons,
padding,
)
def main(page: Page):
page.title = "Outlined buttons with custom content"
page.add(
OutlinedButton(
width=150,
content=Row(
[
Icon(name=icons.FAVORITE, color="pink"),
Icon(name=icons.AUDIOTRACK, color="green"),
Icon(name=icons.BEACH_ACCESS, color="blue"),
],
alignment="spaceAround",
),
),
OutlinedButton(
content=Container(
content=Column(
[
Text(value="Compound button", size=20),
Text(value="This is secondary text"),
],
alignment="center",
spacing=5,
),
padding=padding.all(10),
),
),
)
flet.app(target=main)
边栏推荐
- @Data source connection pool exhaustion caused by transactional abuse
- 【毕业季】绿蚁新醅酒,红泥小火炉。晚来天欲雪,能饮一杯无?
- Kotlin condition control
- 凌云出海记 | 文华在线&华为云:打造非洲智慧教学新方案
- 一文搞懂Go语言中文件的读写与创建
- Kotlin inheritance
- 多表操作-外连接查询
- [QNX Hypervisor 2.2用户手册]6.3.1 工厂页和控制页
- 多表操作-内连接查询
- Neural network IOT platform construction (IOT platform construction practical tutorial)
猜你喜欢
node强缓存和协商缓存实战示例
C # use stopwatch to measure the running time of the program
So this is the BGP agreement
C # better operation mongodb database
Cbcgptabwnd control used by BCG (equivalent to MFC TabControl)
Regular replacement [JS, regular expression]
AP8022开关电源小家电ACDC芯片离线式开关电源IC
【深度学习】一文看尽Pytorch之十九种损失函数
Employment prospects and current situation of Internet of things application technology
[Beijing Xunwei] i.mx6ull development board porting Debian file system
随机推荐
Basic use of kotlin
【毕业季】绿蚁新醅酒,红泥小火炉。晚来天欲雪,能饮一杯无?
Siemens HMI download prompts lack of panel image solution
实战模拟│JWT 登录认证
Lingyun going to sea | Wenhua online & Huawei cloud: creating a new solution for smart teaching in Africa
Chrome开发工具:VMxxx文件是什么鬼
kotlin 继承
PHP pseudo original API docking method
复杂因子计算优化案例:深度不平衡、买卖压力指标、波动率计算
Ziguang zhanrui completed the first 5g R17 IOT NTN satellite on the Internet of things in the world
[Beijing Xunwei] i.mx6ull development board porting Debian file system
Niuke Xiaobai month race 7 e applese's super ability
2022 Health Exhibition, health exhibition, Beijing Great Health Exhibition and health industry exhibition were held in November
Optimize if code with policy mode [policy mode]
NetCore3.1 Json web token 中间件
SSRS筛选器的IN运算(即包含于)用法
C language - Introduction - Foundation - grammar - process control (VII)
Niuke Xiaobai month race 7 who is the divine Archer
1009 product of polynomials (25 points) (PAT class a)
Integritee通过XCM集成至Moonriver,为其生态系统带来企业级隐私解决方案