Python GUI与HTML结合及脚本打包分发指南
1. Python与HTML交互实现GUI
在使用Python编写脚本并通过HTML展示信息与用户交互时,我们可以借助webViewShow API调用。以SMS Sender为例,在HTML端有如下代码逻辑:
if(!button.hasClass(current)){
removeClassFromAll(tabButtons,current);
button.addClass(current);
showOne(tabs,tabs[k]);
}
在Python端,需要有对应的事件处理程序,SMS Sender的处理方式如下:
class SMSSenderHandler(UIHandler):
""" Handler class for this particular application. Extends UIHandler """
def __init__(self):
UIHandler.__init__(self)
# Create the dispatch dictionnary which maps tasks to methods
self.dispatch = {
"loadfile": self.loadfile,
"validate": self.validate,
超级会员免费看
订阅专栏 解锁全文
910

被折叠的 条评论
为什么被折叠?



