Pyjamas Open Source Framework – and little things I learned about it.

I am currently learning Pyjamas, the Python to Javascript compiler. This means writing Javascript without knowing Javascript.
I am at the very begining of my journey. As the title suggests, I will post tiny bits of what I learned about Pyjamas and what I think could be useful to others, too.
This is a living post, I will add content when I learn something new.

How to place the content of an Pyjamas app everywhere you want

Create div in your html-template, where you want to place your app

<div id="my-app"></div>

Then call the div in your python code like this:


How to connect a button to a method in the same class

If you want to connect a button to a method:
Don’t do:

class Example:

  def __init__(self):
    self.exButton = Button("Add", self.exMethod)


   def exMethod(self):

Instead do:

class Example:

  def __init__(self):
    self.exButton = Button("Add",self)


  def onClick(self, sender):
    if sender == self.exButton:

  def exMethod(self):

This way should not only used with buttons, but it should also used with any other widget from Pyjamas.

Update Your Pyjamas Installation

If your are using Pyjamas-0.5 update to to the newest version of Pyjamas!
I had some trouble to get the web2py example running. At the the end it came out the problem was Pyjamas-0.5. So update now!

Now back to learning…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s