当前位置:网站首页>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)
边栏推荐
- Multi table operation - external connection query
- 上线首月,这家露营地游客好评率高达99.9%!他是怎么做到的?
- Dark horse programmer - software testing - stage 07 2-linux and database -09-24-linux command learning steps, wildcards, absolute paths, relative paths, common commands for files and directories, file
- Qt编写物联网管理平台38-多种数据库支持
- Talking about cookies of client storage technology
- Creation of JVM family objects
- Key rendering paths for performance optimization
- 应用实践 | 蜀海供应链基于 Apache Doris 的数据中台建设
- How is the entered query SQL statement executed?
- 凌云出海记 | 文华在线&华为云:打造非洲智慧教学新方案
猜你喜欢

Every time I look at the interface documents of my colleagues, I get confused and have a lot of problems...

Abc229 summary (connected component count of the longest continuous character graph in the interval)
实践示例理解js强缓存协商缓存

上线首月,这家露营地游客好评率高达99.9%!他是怎么做到的?

同事的接口文档我每次看着就头大,毛病多多。。。

The company needs to be monitored. How do ZABBIX and Prometheus choose? That's the right choice!

Related concepts of federal learning and motivation (1)

Introduction to ACM combination counting
一文搞懂Go语言中文件的读写与创建

Wireshark network packet capture
随机推荐
QT writing the Internet of things management platform 38- multiple database support
记一次 .NET 某工控数据采集平台 线程数 爆高分析
Huawei cloud store homepage banner resource bit application
Taishan Office Technology Lecture: about the order of background (shading and highlighting)
So this is the BGP agreement
[QNX hypervisor 2.2 user manual]6.3.1 factory page and control page
多表操作-外连接查询
Kotlin condition control
什么叫内卷?
[ismb2022 tutorial] the picture shows the precision medicine of learning. Marinka zitnik, Harvard University, keynote speaker, with 87 ppt
Decryption function calculates "task state and lifecycle management" of asynchronous task capability
How is the entered query SQL statement executed?
太方便了,钉钉上就可完成代码发布审批啦!
Multi table operation - external connection query
Lingyun going to sea | Murong Technology & Huawei cloud: creating a model of financial SaaS solutions in Africa
MySQL中的日期时间类型与格式化方式
Pointnext: review pointnet through improved model training and scaling strategies++
C # use stopwatch to measure the running time of the program
Dynamic memory management
实践示例理解js强缓存协商缓存