Pyjs - 用于Web和桌面應用開發的 Python RIA 開發平臺
Pyjs 是用于Web和桌面應用開發的 RIA 開發平臺,包含一個 Python 到 JavaScript 的編譯器,一個 Ajax 框架和一組 Widget API。Pyjs 相當于是谷歌的 GWT 的 Python 移植版本,同時也支持桌面應用開發 —— Pyjs Desktop,可直接使用獨立桌面應用程序的方式來運行相同代碼的 Web 項目,而無需打開瀏覽器。
支持以下特性:
- Dynamic and reusable UI components: programmers can use pre-designed classes to implement otherwise time-consuming dynamic behaviors, such as drag-and-drop or sophisticated visual tree structures.
- Supports basic python types, emulated in javascript, such as List, Dictionary, Tuple, string; many of the standard python builtin functions, such as map, filter, range; and some of the standard python Exceptions are supported.
- Declarative style of "desktop" widget programming (almost identical to python-qt4, python-gtk2 and python-wxWidgets), yet the applications are compiled to javascript and run in all major web browsers.
- Simple RPC mechanism
- Browser history management, covering "Back", "Forward" with no hassle for the developer. AJAX applications typically break the "Go Back" button: use the History module to provide your application with History management.
- Run-time Support for runtime errors: a function call stack can be kept in debug mode, and displayed when a runtime error occurs. This is incredibly useful in situations where installing a Javascript debugger is inconvenient or impossible.
- Pyjs handles all cross-browser issues for the developer.
- The developers can mix handwritten JavaScript in the Python source code, including plumbing in to other Javascript frameworks and libraries.
- Beginnings of support for using Google APIs in GWT applications (initially, support for Google Gears Database)
- Pyjs is entirely Free Software.
- The developers can design and develop their application in a pure object-oriented fashion, since they're using Python (instead of JavaScript).
一段簡單的 Pyjs 代碼:
import pyjd # this is dummy in pyjs from pyjamas.ui.RootPanel import RootPanel from pyjamas.ui.Label import Label pyjd.setup('public/hello.html') l = Label('Hello Pyjs') RootPanel().add(l) pyjd.run()
本文由用戶 openkk 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!