Python, wxPython, and Flash: cross-platform projectors

Posted on Thursday 11 May 2006

If only it were true… wxPython is a toolkit that allows the creation of native cross-platform GUI applications using the Python scripting language. Sounds good? Well, it is pretty sweet. One well-known example of a wxPython app is the excellent SEPY by Alessandro Crugnola, aka Sephiroth. I don’t know about you, but I think writing a simple script to create a full-fledged cross-platform application is pretty damn sweet.

Now if you think this is cool, imagine if you could write native cross-platform GUI apps in Python and wxPython and embed Flash for stuff like video, audio, animation, drag-and-drop, and all that Flash goodness. You see, creating rich interfaces in wxPython, is, dare I say, a bitch. I hadn’t realized that stuff we have taken for granted, like anti-aliasing, filters, showing vectors, animation, and all that, is really hard to do in desktop apps without Flash, OpenGL or DirectX. These days I’m working on a wxPython app, and while I must say it is pretty sweet, there is definitely a gap between the solid, fast, responsive GUIs of desktop apps, and the visually rich, innovative GUIs of Flash RIAs. I guess that is one of the reasons that Microsoft is aggressively promoting their Expression designer, as there really is a hole to be filled there.

Now the trouble is that this isn’t yet a reality. wxPython allows to embed an ActiveX control, so Flash can be embedded, but only on Windows. As Darron Schall has pointed out, it would be possible to create a cross-platform Flash control using the Mozilla plugin engine. There is a project out there called wxMozilla that allows to run the NSPlugin architecture inside of an HTML or XUL frame in wxPython. However, that requires (AFAIK) Mozilla (or one of its derivates) to be installed on a user’s computer. In addition, the Flash control is embedded in a wxMozilla frame which is itself embedded in a wxPython app, so communication is a major issue.

If one could isolate the plugin architecture of the wxMozilla project, and create a control that would embed either ActiveX or an NSPlugin, implementing ExternalInterface for communication between Python and Flash, I believe we’d really be on to something good. You see, while I’m glad to see the progress of ScreenWeaver as an open-source projector solution, it solves the Flash-embedding problem from the inside out. That is, first a Flash file is created, and then stuff is added on top of it (interface-wise, file reading, database handling, etc.). While that is good for a Flash-centric application, there are a lot of situations where correct approach is outside in. That is, one would create a wxPython application, and then embed Flash into that. That would allow creating interfaces embedding Flash rather than Flash decorating itself with bits and pieces of desktop functionality.

What’s the point? Well, for one thing, embedding Flash in a traditional desktop app is a powerful way to have access to the advanced UI/graphics/multimedia Flash has to offer. As a parallel, a lot of desktop apps embed HTML frames in various ways. Think, for example, of the Windows CHM help system. It’s a traditional Windows app with a left-hand side tab control for searching and navigating, toolbars, and an HTML frame to display help files. Another example is the latest incarnation of Napster, which displays artist and album information in an HTML frame, while the rest of the application, including a media player and a file organizer, are native controls. HTML is a good medium to display textual information. In the same way, Flash is a good medium to display multimedia. Central has shown us that Flash developers are yearning to grow out of the browser, but that a centralized Flash app repository is not the solution.

Furthermore, projector software will never offer the kind of functionality offered by Python. For example, last year I worked on a kiosk application that allowed the user to swipe a card to show a manager interface. Now the card reader had a Java and (I believe) a Python interface, so what we had to do in the end is create a socket server app which pushed strings onto the socket as events from the card reader occured, and letting Flash know about it through an XMLSocket. An over-the-top solution that was a bitch to implement and that would have been a three line Python effort had we had been able to embed the Flash file in a wxPython app.

Now, before you start crying, there is good news. Apparently there is a preliminary implementation of NSPlugin architecture in the wxPython CVS repository, and all it needs is the attention of a good-natured C++ programmer (something I am definitely not!). If you’re interested in working on this, you can take a look at this thread. In the meantime, we can only dream of the possibilities.


WordPress database error: [Can't open file: 'wp_comments.MYD'. (errno: 145)]
SELECT * FROM wp_comments WHERE comment_post_ID = '195' AND comment_approved = '1' ORDER BY comment_date

No comments have been added to this post yet.

Leave a comment




Your e-mail address is never displayed. If you run into issues with SpamKarma blocking you, email me at $patrick->5etdemi(com)


RSS feed for comments on this post | TrackBack URI