欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2/Agda, C++/Lisp/Haskell
Flexx
来自开放百科 - 灰狐
(版本间的差异)
小 (→指南) |
小 (→图集) |
||
| (未显示1个用户的3个中间版本) | |||
| 第2行: | 第2行: | ||
==指南== | ==指南== | ||
| − | sudo pip install flexx | + | sudo pip install flexx 或 |
| − | from flexx import app, ui | + | git clone https://github.com/zoofio/flexx |
| − | b = ui.Button(text='Hello world!') | + | 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() | app.run() | ||
| + | python3 hello_world.py | ||
==图集== | ==图集== | ||
<gallery> | <gallery> | ||
image:flexx-overview.png|Flexx | image:flexx-overview.png|Flexx | ||
| + | image:hello-flexx-ui.png|Hello UI | ||
</gallery> | </gallery> | ||
2015年9月8日 (二) 09:56的最后版本
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
[编辑] 图集
[编辑] 链接
分享您的观点