微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

htmlPy Python 的 GUI 开发框架

程序名称:htmlPy

授权协议: MIT

操作系统: 跨平台

开发语言: Python

htmlPy 介绍

htmlPy 是对 PySide 的 QtWebKit 库的 Python
封装。可以用 HTML5 和 CSS3 来开发漂亮的图形界面应用程序。基于 Qt 构建,具备高度可定制以及跨平台支持。兼容 Python2 和
python3.可用于任何 Python 库和环境,如 django, flask, scipy, virtualenv 等。也可以使用前端框架,如
bootstrap, jQuery, jQuery UI 等。

一个 htmlPy 基本应用包含如下三个组件:

后端:back_end.py

import htmlPy


class BackEnd(htmlPy.Object):

    def __init__(self, app):
        super(BackEnd, self).__init__()
        self.app = app

    @htmlPy.Slot()
    def say_hello_world(self):
        self.app.html = u"Hello, world"

GUI: main.py

import htmlPy
from back_end import BackEnd

app = htmlPy.AppGUI(
    title=u"Sample application")
app.maximized = True
app.template_path = "."
app.bind(BackEnd(app))

app.template = ("index.html", {})

if __name__ == "__main__":
    app.start()

前端:index.html

<html>
  <body>
    <a
    href="BackEnd.say_hello_world"
    data-bind="true">
      Click to say "Hello, world"
    </a>
  </body>
</html>

htmlPy 官网

http://amol-mandhane.github.io/htmlPy/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐