flet extension library
Project description
fleter
一个flet的扩展组件库,提供一些常用组件及功能。
ComboBox
用于简化Dropdown
的开发过程,option
可以使用列表设置,如["Hello", "World"]
。
import flet
import fleter
def build(page: flet.Page):
item = []
for index in range(20):
item.append(f"item{index}")
page.add(fleter.ComboBox(options=item))
page.update()
flet.app(target=build)
设置选项的状态
很简单,我们只要将选项设置为元组或列表即可。如($name, $disabled)
即可
import flet
import fleter
def build(page: flet.Page):
item = [
"normal", # 默认状态
("disabled", True), # 失效状态
("active", False), # 激活状态
]
page.add(fleter.ComboBox(options=item))
page.update()
flet.app(target=build)
Editor
文本编辑器。
import flet
import fleter
def build(page: flet.Page):
editor = fleter.Editor()
page.add(editor)
page.add(fleter.ComboBox(options=item))
page.update()
flet.app(target=build)
HeaderBar
用于快速设置窗口标题栏。
常规
import flet
import fleter
def build(page: flet.Page):
titlebar = fleter.HeaderBar(page, title="Hello World")
page.add(
titlebar
)
page.update()
flet.app(target=build)
标题栏靠左-切换主题按钮
import flet
import fleter
def build(page: flet.Page):
titlebar = fleter.HeaderBar(page, title="Hello World", title_align="left")
titlebar.controls.insert(1, fleter.SwichThemeButton(page))
page.add(
titlebar
)
page.update()
flet.app(target=build)
获取标题栏里面的关闭按钮
可以在组件中找到close_button
的属性,并对其进行设置。(前提是设置has_close
属性为True
)
import flet
import fleter
def build(page: flet.Page):
titlebar = fleter.HeaderBar(page)
print(titlebar.close_button)
page.add(
titlebar
)
page.update()
flet.app(target=build)
设置是否有关闭按钮
我们知道HeaderBar
初始化时有个has_close
的属性,如果需要在后面设置是否有关闭按钮时,就可以调用has_close
属性进行设置
import flet
import fleter
def build(page: flet.Page):
titlebar = fleter.HeaderBar(page)
titlebar.close_button = False # True保留关闭按钮,False不保留关闭按钮
page.add(
titlebar
)
page.update()
flet.app(target=build)
NoteBook
用于快速制作选项卡。
常规
import flet
import fleter
def main(page: flet.Page):
notebook = fleter.NoteBook()
for item in range(10):
notebook.add(notebook.create(f"Item {item+1}", flet.Text(value=f"I`m item {item + 1}")))
page.add(
notebook
)
page.update()
flet.app(target=main)
选项可关闭
import flet
import fleter
def main(page: flet.Page):
notebook = fleter.NoteBook()
for item in range(10):
notebook.add(notebook.create_with_can_close(f"Item {item+1}", flet.Text(value=f"I`m item {item + 1}")))
page.add(
notebook
)
page.update()
flet.app(target=main)
选项卡关闭提示
import flet
import fleter
def main(page: flet.Page):
notebook = fleter.NoteBook()
for item in range(10):
notebook.add(notebook.create_with_can_close(f"Item {item+1}", flet.Text(value=f"I`m item {item + 1}"), close_tip=True))
page.add(
notebook
)
page.update()
flet.app(target=main)
SwichThemeButton
用于快速切换窗口主题的图标按钮组件。
常规
import flet
import fleter
def main(page: flet.Page):
swich_theme_button = fleter.SwichThemeButton(page)
page.add(
swich_theme_button
)
page.update()
flet.app(target=main)
无系统主题选项
import flet
import fleter
def main(page: flet.Page):
swich_theme_button = fleter.SwichThemeButton(page, has_system=False)
page.add(
swich_theme_button
)
page.update()
flet.app(target=main)
SpinBox
进步器,用于调整整数或浮点数的数值
import flet
import fleter
def main(page: flet.Page):
page.add(
fleter.SpinBox()
)
page.update()
flet.app(target=main)
浮点数步进器
import flet
import fleter
def main(page: flet.Page):
page.add(
fleter.SpinBox(plus=0.1, minus=0.1)
)
page.update()
flet.app(target=main)
最大值与最小值
设置步进器可设置的最大值。
import flet
import fleter
def main(page: flet.Page):
page.add(
fleter.SphinBox(max_value=5, min_value=-5)
)
page.update()
flet.app(target=main)
Time
使用threading
库做出来的记时工具。
import flet
import fleter
def main(page: flet.Page):
def tick(id, tick_time):
print(f"{id} {tick_time}")
time = fleter.Time(tick)
time.start("time", 10)
page.update()
flet.app(target=main)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fleter-0.1.7.tar.gz
(12.1 kB
view details)
Built Distribution
fleter-0.1.7-py3-none-any.whl
(11.7 kB
view details)
File details
Details for the file fleter-0.1.7.tar.gz
.
File metadata
- Download URL: fleter-0.1.7.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e31f9dfcba59bf36270dee5faa809830acfa61eb1323154fea90df96fa30b84e |
|
MD5 | 1be0b64b04df5a64c99b2cde8ccbc902 |
|
BLAKE2b-256 | ae478fda95dbdff304fc9b8cf994e8c6556fe759c11f046d2e7ed93e2ce8ccce |
File details
Details for the file fleter-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: fleter-0.1.7-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c8ff9d22835ee35533b848f641af5c4aee57dc31442f0aa80ec152868b5c679 |
|
MD5 | a993bee3dd4477edd0e3e7c663796bfd |
|
BLAKE2b-256 | 5ca4114f16e504fde2b8496fdbdccf65a3ca468158951422be3080ffa14acd93 |