推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
hxse
V2EX  ›  Python

Flet, 用 Python 写 flutter, 一个 electron 的代替品

  •  
  •   hxse · Jul 17, 2022 · 3414 views
    This topic created in 1402 days ago, the information mentioned may be changed or developed.

    https://github.com/flet-dev/flet

    import flet
    from flet import IconButton, Page, Row, TextField, icons
    
    def main(page: Page):
        page.title = "Flet counter example"
        page.vertical_alignment = "center"
    
        txt_number = TextField(value="0", text_align="right", width=100)
    
        def minus_click(e):
            txt_number.value = int(txt_number.value) - 1
            page.update()
    
        def plus_click(e):
            txt_number.value = int(txt_number.value) + 1
            page.update()
    
        page.add(
            Row(
                [
                    IconButton(icons.REMOVE, on_click=minus_click),
                    txt_number,
                    IconButton(icons.ADD, on_click=plus_click),
                ],
                alignment="center",
            )
        )
    
    flet.app(target=main)
    

    试例 大家觉得怎么样

    ChrisFreeMan
        1
    ChrisFreeMan  
       Jul 17, 2022 via iPhone
    听起来很梦幻,但是我之前被 python Gui 开发坑怕了。
    catsoul
        2
    catsoul  
       Jul 18, 2022
    可以,不过打算再观望一下,毕竟这种类型的东东层出不穷但是真正维护到具有实用价值的寥寥
    lolizeppelin
        3
    lolizeppelin  
       Jul 19, 2022
    flutter 学习麻烦在于熟悉 flutter 本身的控件,用 python 来写控件还不是得熟悉 flutter 的控件?
    就好比用 python 来写 Spring Boot,你要熟悉的是 Spring Boot 而不光是 java 。

    dart 的语法又不多,dart 本身也不难,还是原生协程,转用 python 写毫无意义。
    mayli
        4
    mayli  
       Jul 26, 2022
    @lolizeppelin 确实,混合语言都有调用问题,写来写去如果不是语法上完美支持,都会遇到所谓的坑。不过 py->flutter->web 挺梦幻的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4842 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 59ms · UTC 09:40 · PVG 17:40 · LAX 02:40 · JFK 05:40
    ♥ Do have faith in what you're doing.