Differences between revisions 4 and 6 (spanning 2 versions)
Revision 4 as of 2008-10-23 11:22:52
Size: 4255
Editor: 88-106-28-137
Comment:
Revision 6 as of 2008-10-23 11:31:35
Size: 4446
Editor: 88-106-28-137
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
This topic covers ways in which python can be used in web browsers to control, create or manipulate the content within a user's web browser, or a web-based technology (such as [http://webkit.org webkit], the technology behind afari, the OLPC Browser, Adobe AIR, Google Chrome and much more; and Gecko, the engine behind [http://mozilla.com/firefox Firefox], XULRunner and much more). Specifically excluded from the list is technology that simply generates static HTML content, but technology that generates or compiles javascript definitely counts. This topic covers ways in which python can be used in web browsers to control, create or manipulate the content within a user's web browser, or a web-based technology (such as [http://webkit.org webkit], the technology behind Safari, the OLPC Browser, Adobe AIR, Google Chrome and much more; and Gecko, the engine behind [http://mozilla.com/firefox Firefox], XULRunner and much more). Specifically excluded from the list is technology that simply generates static HTML content, but technology that generates or compiles javascript definitely counts.
Line 7: Line 7:
 These are tools that convert python into javascript, that can then be run either stand-alone or in a web browser.  These are tools that convert python into javascript, that can then be run either stand-alone, using technology such as spidermonkey and pyv8, or in a web browser (where, in order to be useful, the applications must of course interface with the DOM model of the browser, typically using an AJAX library).

Web Browser Programming in Python

This topic covers ways in which python can be used in web browsers to control, create or manipulate the content within a user's web browser, or a web-based technology (such as [http://webkit.org webkit], the technology behind Safari, the OLPC Browser, Adobe AIR, Google Chrome and much more; and Gecko, the engine behind [http://mozilla.com/firefox Firefox], XULRunner and much more). Specifically excluded from the list is technology that simply generates static HTML content, but technology that generates or compiles javascript definitely counts.

Python to Javascript Compilers

  • These are tools that convert python into javascript, that can then be run either stand-alone, using technology such as spidermonkey and pyv8, or in a web browser (where, in order to be useful, the applications must of course interface with the DOM model of the browser, typically using an AJAX library).
  • ["Pyjamas"] is a Python-to-Javascript compiler and AJAX-based Web Toolkit and Framework that allows users to write code in standard python that will be run in a web browser, after translation to javascript. pyjs - the compiler - can also be used as a stand-alone javascript compiler.
  • Py2Js is an unmaintained project that can still be downloaded [http://davidf.sjsoft.com/files/py2js here]. It is purely a python-to-javascript compiler / translator.

  • PyPy is compiler technology that contains an alternative python interpreter front-end and also supports javascript as output on the back-end. [http://codespeak.net/pypy/dist/pypy/doc/js/using.html Using Pypy/JS] describes how to integrate with libraries such as mochikit.

Embedding Python inside Web Browsers

  • This section describes projects where the python interpreter itself can and has been embedded into the web browser. Instead of downloading the standard python executable and libraries, these projects come with the python runtime and libraries pre-embedded (and, as such, are typically very large downloads).
  • PyXPComExt has the full Python interpreter embedded. [http://pyxpcomext.mozdev.org/ PyXPCOMExt] is the interpreter as a XULRunner extension; [http://developer.mozilla.org/en/PyDOM PyDOM] is a library that will almost certainly be needed, that allows you to manipulate the browser's DOM model using python. The API is (almost) identical to that of javascript.

Python wrappers around Web "Libraries" and Browser Technology

  • This section describes projects where you can (or have to) create your own web browser application in python. It includes web browser "engines" that have python interfaces to access, control and present web pages and web-relevant rich media content (such as Adobe Flash).
  • PyWebKitGtk - [http://code.google.com/p/pywebkitgtk PyWebkitGtk] is a python wrapper around [http://webkit.org Webkit] that embeds the Webkit "engine" as a GTK widget. The standard version of pywebkitgtk is unable to provide access to the DOM model, treating pywebkit as a hands-off widget that can be used to write your own Web Browser (see demobrowser.py). However, a [https://bugs.webkit.org/show_bug.cgi?id=16401 patch to webkit] and a corresponding patch to pywebkitgtk will soon bring DOM model manipulation to python: see PyjamasDesktop for details.

  • PyWebkitQt4 is a python wrapper again around Webkit but this time as a Qt4 widget. Bindings to the DOM model have not been added to PyWebkitQt4, and so you can only use PyWekitQt4 to create your own web browser, rather than manipulate the DOM model content itself.

  • PyKDE - KDE contains python bindings to KHTMLPart (which is very similar to Webkit). This allows you to embed HTML into an application window. The Python bindings to the DOM model are slightly... obtuse. to say the least, and PyKHTML - [http://paul.giannaros.org/pykhtml/ PyKHTML] makes them much more tolerable (see dom.py). However, there are limitations in PyKDE's DOM bindings (that many people will never encounter) that you should investigate thoroughly before utilising PyKDE for seriously heavy-duty DOM model manipulation.

  • Webkit with the ObjectiveC bindings (MacOSX users only). [http://webkit.org Webkit] itself has ObjectiveC bindings, on MacOSX. MacOSX's ObjectiveC technology comes with automatic bindings to all major programming languages, including python. Consequently, you can directly manipulate the DOM model from python.

WebBrowserProgramming (last edited 2022-05-08 08:36:36 by Olivier Pirson)

Unable to edit the page? See the FrontPage for instructions.