当前位置:网站首页>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。
边栏推荐
- Unity particle special effects series - treasure chest of shining stars
- Distributed (consistency protocol) leader election (dotnext.net.cluster implements raft election)
- [rapid environment construction] openharmony 10 minute tutorial (cub pie)
- 酷雷曼多种AI数字人形象,打造科技感VR虚拟展厅
- C WinForm series button easy to use
- Total / statistics function of MySQL
- Solid principle
- The art of Engineering (3): do not rely on each other between functions of code robustness
- Spark accumulator and broadcast variables and beginners of sparksql
- connection reset by peer
猜你喜欢
Automatic operation and maintenance sharp weapon ansible Foundation
The problem of "syntax error" when uipath executes insert statement is solved
FlutterWeb瀏覽器刷新後無法回退的解决方案
在一台服务器上部署多个EasyCVR出现报错“Press any to exit”,如何解决?
The most complete tcpdump and Wireshark packet capturing practice in the whole network
node の SQLite
02 personal developed products and promotion - SMS platform
Start job: operation returned an invalid status code 'badrequst' or 'forbidden‘
[ASM] introduction and use of bytecode operation classwriter class
OpenCV中如何使用滚动条动态调整参数
随机推荐
Deploy flask project based on LNMP
Vscode matches and replaces the brackets
Development and practice of lightweight planning service tools
[introduction to MySQL] third, common data types in MySQL
MySQL 8 sub database and table backup database shell script
The solution that flutterweb browser cannot be rolled back after refreshing
Alibaba brand data bank: introduction to the most complete data bank
Virtual machine startup prompt probing EDD (edd=off to disable) error
Flink parsing (IV): recovery mechanism
Alertmanager sends the alarm email and specifies it as the Alibaba mailbox of the company
The most complete tcpdump and Wireshark packet capturing practice in the whole network
Yarn: unable to load file d:\programfiles\nodejs\yarn PS1, because running scripts is prohibited on this system
当前系统缺少NTFS格式转换器(convert.exe)
一体化实时 HTAP 数据库 StoneDB,如何替换 MySQL 并实现近百倍性能提升
EasyRE WriteUp
C # nanoframework lighting and key esp32
JMeter interface test response data garbled
Growth of operation and maintenance Xiaobai - week 7
[elastic] elastic lacks xpack and cannot create template unknown setting index lifecycle. name index. lifecycle. rollover_ alias
Application service configurator (regular, database backup, file backup, remote backup)