[triangle-zpug] Desktop apps in Python?

David Handy david at handysoftware.com
Mon Aug 16 14:20:57 CEST 2004

On Sun, 15 Aug 2004, Jim Allman wrote:

> David and Tom,
> Thanks for great feedback! Plenty to chew on here, and you've both 
> helped me to understand the distinctions between all the tools in my 
> list.
> I'm shooting for the "shrink-wrap" experience, where a fairly naive 
> user can download a single installer and quickly have joy.

As long as the naive user can figure out *which* of your installers to 
download from your website!

> I'm currently pondering an odd combination of tools--sounds crazy, but 
> it just might work for my purposes:
> - Build the UI in Macromedia Flash (standalone app in Mac and Win, or 
> in a browser under Linux)
> - Add a separate Python engine for file I/O and network operations, 
> probably based on Twisted
> - User launches the Python process, which in turn launches the local 
> client (app or browser)
> - These two partners communicate via XML-RPC on an unused port
> - For distribution, freeze the Python engine with its own interpreter
> - Bundle the resulting files appropriately for each system, e.g. a 
> packaged app folder on OS X
> This reduces the Python dependencies to just Twisted and any other 
> modules, plus the included Python interpreter. It seems like this would 
> avoid the usual configuration hassles of wxPython, wxWindows, etc etc.
> Flash (esp the recent Player v7) provides a nice and consistent client 
> environment, including a broad widget set--IMO, it's a better Java than 
> Java in this sense. Python/Twisted would pick up the slack where Flash 
> is limited (filesystem access, encryption, SSL, XML generation, data 
> storage and indexing...)
> The result would not feel quite like a "native" desktop app. It would 
> have limited support for clipboard operations, drag-and-drop, etc. But 
> I think it could install and launch easily, and would be a platform for 
> *tons* of functionality and a very rich user interface.
> Thoughts? (I realize that most people aren't going to be comfortable 
> coding apps in Flash/Actionscript, but I find that it's a mature tool 
> and getting better all the time.)

Actually, this sounds like a reasonable approach. You let the Flash and
browser folks do the hard work of packaging and distributing the
multimedia stuff, and use portable Python code for the stuff that's hard
to do in Flash.

I like the simplicity of the Python xmlrpclib module, but it is slow for
some things, and is limited to one-way request-response conversations
(unless you can make Flash function as an XMLRPC server as opposed to it
just being the client.) Hopefully that will be Ok for your intended use.

I've seen a similar thing done with a Python game, where it starts up a
CGI web server, and then launches your browser with a url that connects it
to that server. Then you have the weird experience of clicking on a link
in the web page and having it start up a pygame window ... how did they do
that? Oh yeah, the web server and the pygame program are all the same
process running on your local machine, so no browser security restrictions

Anyway, it sounds like you have an interesting plan. Good luck, let us 
know how it goes!

David H.

More information about the triangle-zpug mailing list