Hello everyone,<div><br></div><div>Pyjamas is a <span class="Apple-style-span" style="font-family: sans-serif; font-size: medium; ">Python-to-Javascript compiler, an AJAX framework and a Widget Set API. Pyjamas started life as a Python port of <a href="http://code.google.com/webtoolkit/" style="color: rgb(0, 0, 139); ">Google Web Toolkit</a>, the Java-to-Javascript compiler.</span></div>
<div><span class="Apple-style-span" style="font-family: sans-serif; font-size: medium; "><br></span></div><div><span class="Apple-style-span" style="font-family: sans-serif; font-size: medium; ">The above is copied and pasted from their project website:  </span><a href="http://pyjs.org/">http://pyjs.org/</a></div>
<div><br></div><div>It is very similar to programming a GTK application in Python, and uses many of the same ideas from GTK development.  Since it compiles to pure javascript(which is by default cross-browser compatible), no server-side software is needed.  In fact, you can run it locally from "file:///" if you really wanted to.  However, one will need a server in order to bind widgets to a backend database for example.  It comes with a full JSON library as well.  However, for anything that does not require a datastore, and uses pure python modules, it make any Python application available through the web.  For example, you have a current Python application which uses a CLI, does not need to save or load data from storage, you can use this solution to make a nice UI which is cross-platform and easy to share with others.</div>
<div><br></div><div>Pyjamas developers state that you can take any widely available Python module and convert it to pure javascript using their compiler.  As long the module is made in pure Python code, not a C module, for example.  A module which has been demonstrated to compile to javascript is PureMVC.  PureMVC is a cross-platform cross-language model-view-controller library.  It has been ported to Python, C, and many other languages.  It can be found here: <a href="http://puremvc.org/">http://puremvc.org/</a></div>
<div><br></div><div>Best of all, to use Pyjamas one only needs to know Python, HTML is optional.  CSS is good, as it is used to style the various widgets.  I began using Pyjamas recently to make websites as I prefer to make both the frontend and the backend in Python, with little coding in HTML/JS/CSS.  Think of it as a PURE PYTHON website.  It also keeps the frontend and backend completely separate from eachother.  Forming a complete model-view-controller, none of the code from the frontend sees the backend, and vise versa.  Pyjamas also comes with a complete example of a Gmail clone, their version resembles ms-outlook more than Gmail, but is a great example of it's potential.</div>
<div><br></div><div>Pyjamas Examples: <a href="http://pyjs.org/examples/">http://pyjs.org/examples/</a></div><div>My favorite example(using HTML5 canvas, compatible with Firefox): <a href="http://pyjs.org/examples/asteroids/output/Space.html">http://pyjs.org/examples/asteroids/output/Space.html</a></div>
<div>The source for the above example: <a href="http://pyjs.org/examples/asteroids/Space.py">http://pyjs.org/examples/asteroids/Space.py</a></div><div><br></div><div>I think this is a good example, as it shows extensive use of the Python math and random libraries to do calculations which are compiled to Javascript.</div>
<div><br></div><div>In effect, why make the server do all those complex calculations in Python, when most modern computers and browsers with JavaScript can do them pretty fast and even cross platform.  However, for those very very complex calculations, a simple JSON request to a server-side python script can be done easily.  Mind you, Google Chrome has a very optimized JavaScript engine and may perform at the same speed as a Python interpreter.  Benchmarks anyone?</div>
<div><br></div><div>Let me know what you think of this python-to-javascript compiler and what uses you think it may come in handy for.</div><div><br></div><div>Kevin.</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8">