Skip to content


xtfxme edited this page May 13, 2012 · 26 revisions

Getting Started

Pyjamas is slightly different from traditional Web development: it's more like Desktop application development. This guide should help you to get started quickly in developing your first application. You'll find references to API documentation, more tutorials and other guides in the Resources section below.

Just a quick getting started with Pyjamas

Get the source either the git (preferred) or snapshot:

git clone

Read the README and INSTALL.txt, which comes basically down to:

cd <pyjamas directory>

Install Pyjamas:

sudo python install

Install Pyjamas-Desktop:

sudo python install


The latter scripts will create the pyjs and pyjd folders in /usr/local/lib/python2.6/dist-packages/ (system-wide installation) hence the need for running as root.

Go to the examples:

cd examples

Read the README, which will lead you to do:

python .

(or python if you have python 2.5 or earlier)

If you've got apache running, add this to your default site config:

Alias /examples "REPLACE THIS/pyjamas/examples/"
<Directory "REPLACE THIS/pyjamas/examples/">
    Options Indexes MultiViews FollowSymLinks +ExecCGI
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from ::1/128
    AddHandler cgi-script .py

and point your browser to http://localhost/examples/

Checkout the /examples/helloworld/ helloworld example

Look at it /examples/helloworld/output/Hello.html in the browser

Look at the source code:

from pyjamas import Window
from pyjamas.ui import RootPanel, Button

def greet(sender):
    Window.alert("Hello, AJAX!")

class Hello:
    def onModuleLoad(self):
        b = Button("Click me", greet)

Play with the code on your local machine, use the script (or ../../bin/pyjsbuild <ModuleName>) to compile your python code to HTML and JavaScript, see what happens.

  • Look at some more examples, in the /examples/ directory
  • Look at some more examples
  • Did I say 'Look at some more examples'?
  • Build your own from a copy from helloworld


If you run into problems installing Pyjamas (read: if you can't get the example applications running due to import errors) see the following articles:

Learning Resources

  • Pyjamas API documentation [TODO: Add link]
  • /examples/kitchensink/output/KitchenSink.html - UI Controls showcase
  • /uiHierarchy.html - UI Hierarchy documentation
  • /controls_tutorial.html - Writing Controls tutorial
  • /controls_tutorial02.html - Event Handling tutorial
  • Pyjamas examples (show cases), /showcase/Showcase.html //(defunct)//
  • /book/output/Bookreader.html#Getting%20Started - Pyjamas Book
  • /getting_started.html - Getting Started with Pyjamas (Tutorial)

!tag howto tutorial

Something went wrong with that request. Please try again.