Flexx

来自开放百科 - 灰狐
2015年9月8日 (二) 09:56Allen (讨论 | 贡献)的版本

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转到: 导航, 搜索

Flexx

指南

sudo pip install flexx 或
git clone https://github.com/zoofio/flexx
python3 setup.py install 
git clone https://github.com/tornadoweb/tornado
python3 setup.py install  
>>> from flexx import app, ui
>>> b = ui.Button(text='Hello world!') 
Serving apps at http://localhost:49270/

hello_world.py

from flexx import app, ui, react
from tornado import ioloop
class Example(ui.Widget):
    def init(self):
        self.count = 0
        with ui.HBox():
            self.button = ui.Button(text='Click me', flex=0)
            self.label = ui.Label(flex=1)
    @react.connect('button.mouse_down')
    def _handle_click(self, down):
        if down:
            self.count += 1
            self.label.text('clicked %i times' % self.count)
main = app.launch(Example)
app.run()

python3 hello_world.py

图集

链接

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱