Client-side web scripting in Python?

Paul Everitt paul at zope.com
Fri Jan 4 16:27:42 CET 2002


Hi Rolf.  I'm tinkering around with something similar.  That is, using 
IE5.5 as the GUI for a data model in XML and logic in Python (via 
win32all's support for ActiveScripting).  I've made a bit of progress, 
so if you'd like to send me an email on the subject, go right ahead.

Note that you'll probably want to approach this as an "HTA" (HTML 
Application), an IE5.5+ approach that lets you lower the security system 
in IE and function with all the privileges a regular, full-blown Python 
app would provide.

A number of posts in this thread have questioned the approach of using 
web-oriented technologies as a GUI.  I think it's worth considering.  On 
the upside, if you know HTML/CSS/DOM/XML/XSLT etc., then you'll get to 
leverage a LOT of knowledge.

For example, here's a series of articles on GUI design using client-side 
XML and XSLT:

   http://www.15seconds.com/Issue/010921.htm
   http://www.15seconds.com/issue/010927.htm
   http://www.15seconds.com/issue/011113.htm
   http://www.15seconds.com/issue/011129.htm
   http://www.15seconds.com/issue/011212.htm

These tutorials show how to build an expandible tree with event 
handlers, context menus, insert/delete/update, drag-and-drop, and a 
progress indicator.

For my project I'm using Python's COM support to put a DOM-like view on 
Outlook data, which I can then "persist" either to a local XML file or 
to/from a remote Zope site.  The GUI for the app is an IE5.5 HTA, with 
XML as the model, XSLT and CSS as the view, a combination of JavaScript 
and Python as the logic, and the XmlHttpRequest component for networking 
over HTTP.

--Paul

Rolf wrote:

> Paul Rubin <phr-n2001d at nightsong.com> wrote in message news:<7x3d1r2paa.fsf at ruckus.brouhaha.com>...
> 
>>rolffreimuth at hotmail.com (Rolf) writes:
>>
>>>Is there any way to do *pure* python client-side scripting?  Are there
>>>any good resources with examples of how to do it?
>>>
>>If you mean for publishing web pages on the internet, it doesn't sound
>>like such a great idea.  I've stopped paying attention to Windoze but
>>I believe there's a Python version (ActiveState?) that's callable as a
>>COM object.  So you'd have to download the huge interpreter to the
>>client, and then you could call it from Javascript.  You should be
>>able to pass it the document object as an argument.  From there, the
>>python script can use the regular COM automation methods to navigate
>>inside the document object, or it can call javascript code to
>>manipulate the document.  I've forgotten most of this stuff but
>>basically once you get hold of the IWebBrowser2 interface you can
>>make the browser do most anything you want.
>>
> 
> 
> I dont mean for it to be a web application.  I am just considering it
> as a possibility for a simple GUI.  To run the app, a user would need
> Python installed, plus MSIE, plus a few other python libs.  It is
> primarily for my own use and education.  To launch the app, the user
> would just click on an HTML file on the local hard drive.
> 
> Having the GUI in a browser is an advantage for this application.  The
> app basically scans a directory tree for large digital photos (~2MB
> each) then it uses PIL to create thumbnails and and some more
> reasonably sized "large" images for publishing on the web.  I also was
> considering writing some code to manage the FTP of the "processed"
> images up to my website.
> 
> Rolf
> 







More information about the Python-list mailing list