Tux-UKUUG logo
Linux 2008
Conference and Workshop
Friday 7th - Sunday 9th November

Linux 2008

Call For Papers

Python Web Workshop









Other UKUUG events

Luke Kenneth Casson Leighton

Coding in Pyjamas: Apps for Desktop and the Web

One web site CSS hack too many resulted in a vow never to do straight HTML / CSS programming ever again. After two weeks failing to do a simple web site with only 100 words centred in the middle of the page, Pyjamas - a Python to Javascript compiler - came up with the answer in under forty minutes.

Pyjamas is a port of Google's Web Toolkit to Python. Pyjamas Desktop is a port of Pyjamas to the Desktop, using Apple's Webkit as the underlying technology. The combination of these two technologies - with identical APIs and features - means that applications can be written that will run - unmodified - in both a web browser and on the desktop.

GWT and Pyjamas provide the developer with a simple "Desktop-like" set of widgets, including menus, buttons, Timers, Listboxes - everything you'd normally expect of a Desktop application. Except that GWT and Pyjamas are actually AJAX compilers, and you end up with javascript that runs in a browser. And Pyjamas-Desktop replaces all the javascript with python code that uses direct DOM manipulation through Webkit's glib / gobject bindings, instead of through the slower javascript.

The most important feature of all the Web-based toolkits (GWT, YUI, Pyjamas) is that all of the browser quirks that you'd normally expect to have to melt your brain on are taken care of: the compiler tool automatically generates code specifically for Firefox, old Mozilla, Internet Explorer, Opera and Safari!

The strategic importance of Pyjamas cannot be underestimated, especially as code written for it looks so much like it uses pygtk2 or python-qt4, and especially as applications written with care for Pyjamas can be run unmodified under Pyjamas-Desktop.

The talk will outline some of the quirks that make coding using Pyjamas just that little bit tricky - not least is the simple fact that you must never forget that you end up running javascript, not python.

Also, the talk will showcase a video chat and online board game web site, using Red5, Pyjamas, Django, Python-JSON, libcommonDjango and two simple Flash Actionscript plugins (for the webcams). The Javascript is presently up to 1.4 megabytes in size.

For more information please contact UKUUG Problems? e-mail webmaster
© Copyright 2008 UKUUG Ltd