[英]Simple web gui for python script without side web server
For example, simple while loop, with control in the browser: 例如,简单的while循环,在浏览器中具有控件:
python script: python脚本:
#!/usr/bin/python
import random
import time
Delay = 1 # Default
while True:
seed = random.random()
time.sleep( Delay )
# Show seed in browser
While while loop
works, I want to see random seed each second in web browser and ability to change Delay
without reloading page, ajax interface. 虽然
while loop
有效,但我希望每秒钟在Web浏览器中看到随机种子,并且希望能够在不重新加载页面,ajax界面的情况下更改Delay
。
I'm trying to choose true way here: wiki.python.org/moin/WebFrameworks , methinks that django framework is too huge for such easy task. 我在这里尝试选择正确的方式: wiki.python.org/moin/WebFrameworks ,方法认为django框架对于如此简单的任务来说太大了。
Simple and lightweight framework WSGIServlets 简单轻巧的框架WSGIServlets
Hello world example: 您好世界示例:
from wsgiservlets import *
class helloworld(HTMLPage):
def write_content(self):
self.writeln("Hello, World!")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.