Skip to main content

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)

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)

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)

SphinBox

进步器,用于调整整数或浮点数的数值

import flet
import fleter

def main(page: flet.Page):
    page.add(
        fleter.SphinBox()
    )
    page.update()

flet.app(target=main)

浮点数步进器

import flet
import fleter

def main(page: flet.Page):
    page.add(
        fleter.SphinBox(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


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.1.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

fleter-0.1.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file fleter-0.1.1.tar.gz.

File metadata

  • Download URL: fleter-0.1.1.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for fleter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2e6a4d310124448e840baade9f113e96227f39b1d1a86a7f4bf5d09484faf809
MD5 4d8be6600e181644694f6042ab49586b
BLAKE2b-256 6c316e3e1498a157f68ab1b81b763b711532262e074d46d9787116a73fa97ad1

See more details on using hashes here.

File details

Details for the file fleter-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: fleter-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for fleter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 19913f72e59da9f7ea483a1cc6e158e6de0c3af030b592153b08646d0589e595
MD5 dc129fd30131866227490111448416be
BLAKE2b-256 e03025f0370f89eaf208b5c0e45bb95291c04fc0a91b3403e89d52b9623bd667

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page