欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
Flexx
来自开放百科 - 灰狐
(版本间的差异)
小 (→指南) |
小 (→指南) |
||
第5行: | 第5行: | ||
git clone https://github.com/zoofio/flexx | git clone https://github.com/zoofio/flexx | ||
python3 setup.py install | python3 setup.py install | ||
− | from flexx import app, ui | + | git clone https://github.com/tornadoweb/tornado |
− | b = ui.Button(text='Hello world!') | + | 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 | ||
==图集== | ==图集== |
2015年9月8日 (二) 09:52的版本
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
图集
链接
分享您的观点