当前位置:网站首页>Flet教程之 13 ListView最常用的滚动控件 基础入门(教程含源码)
Flet教程之 13 ListView最常用的滚动控件 基础入门(教程含源码)
2022-07-06 09:41:00 【知识大胖】
Flet是什么
Flet 是一个框架,使您能够轻松地以您喜欢的语言构建实时 Web、移动和桌面应用程序,并与您的团队安全地共享它们。无需前端经验。
什么是ListView
ListView 是最常用的滚动控件。它在滚动方向上一个接一个地显示其子级。在交叉轴上,子项需要填充 ListView。
实战代码
from time import sleep
import flet
from flet import ListView, Page, Text
def main(page: Page):
page.title = "Auto-scrolling ListView"
lv = ListView(expand=1, spacing=10, padding=20, auto_scroll=True)
count = 1
for i in range(0, 60):
lv.controls.append(Text(f"Line {count}"))
count += 1
page.add(lv)
for i in range(0, 60):
sleep(1)
lv.controls.append(Text(f"Line {count}"))
count += 1
page.update()
flet.app(target=main)
参数
controls
Control要在 ListView 中显示的 s 列表。horizontal
True水平布局 ListView 项目。spacing
ListView 项之间的 Divider 的高度。如果未指定,则项目之间没有间距。divider_thickness
如果大于0则 Divider 用作 ListView 项之间的间距。padding
插入子项的空间量。
有关更多信息和可能的值,请参见Container.padding属性。
auto_scroll
True如果子级更新时滚动条应自动将其位置移动到末尾。item_extent
horizontal用于优化呈现的项目的固定高度或宽度(对于ListView)。first_item_prototype
True如果第一个项目的尺寸应该用作所有其他项目的“原型”,即它们的高度或宽度将与第一个项目相同。默认为False。
边栏推荐
- BearPi-HM_ Nano development environment
- 03 products and promotion developed by individuals - plan service configurator v3.0
- Spark calculation operator and some small details in liunx
- The problem of "syntax error" when uipath executes insert statement is solved
- Single responsibility principle
- Display picture of DataGridView cell in C WinForm
- [introduction to MySQL] third, common data types in MySQL
- C version selenium operation chrome full screen mode display (F11)
- Pyspark operator processing spatial data full parsing (5): how to use spatial operation interface in pyspark
- TCP连接不止用TCP协议沟通
猜你喜欢
全网最全tcpdump和Wireshark抓包实践
node の SQLite
Zen integration nails, bugs, needs, etc. are reminded by nails
网络分层概念及基本知识
Easy introduction to SQL (1): addition, deletion, modification and simple query
[getting started with MySQL] fourth, explore operators in MySQL with Kiko
Kali2021 installation and basic configuration
Spark accumulator and broadcast variables and beginners of sparksql
Chrome prompts the solution of "your company management" (the startup page is bound to the company's official website and cannot be modified)
Pyspark operator processing spatial data full parsing (4): let's talk about spatial operations first
随机推荐
The art of Engineering (3): do not rely on each other between functions of code robustness
Unity粒子特效系列-闪星星的宝箱
Development and practice of lightweight planning service tools
Xin'an Second Edition; Chapter 11 learning notes on the principle and application of network physical isolation technology
【ASM】字节码操作 ClassWriter 类介绍与使用
TCP connection is more than communicating with TCP protocol
Total / statistics function of MySQL
Pyspark operator processing spatial data full parsing (4): let's talk about spatial operations first
[introduction to MySQL] third, common data types in MySQL
微信小程序获取手机号
PySpark算子处理空间数据全解析(4): 先说说空间运算
pip install pyodbc : ERROR: Command errored out with exit status 1
Summary of study notes for 2022 soft exam information security engineer preparation
Flink parsing (III): memory management
RepPoints:可形变卷积的进阶
Guidelines for preparing for the 2022 soft exam information security engineer exam
connection reset by peer
MySQL报错解决
The art of Engineering
Wechat applet obtains mobile number