pyjamas: GWT clone in Python

Since GWT has been released for a week, Google was released its new version yesterday. GWT is now so popular. Anyway, I don’t like to program in Java. Now, there is a serious effort to reverse engineer GWT to make a clone in Python for Python fans like me. In beginning, it named as py-gwt but now it has been changed to pyjamas and it’s alive. Let’s see how it looks like at the real code in subversion repository.

In Python:

from ui import Button, RootPanel

class Hello:
    def onModuleLoad(self):
        b = Button("Click me")
        RootPanel().add(b)

In JavaScript:

function Hello() {
}
Hello.prototype.onModuleLoad = function() {
    var b = new ui_Button("Click me");
    new ui_RootPanel().add(b);
}

function run() {
    h = new Hello();
    h.onModuleLoad();
}

function pygwtOnLoad(onLoadError, name) {
    if (onLoadError)
        try {
            run();
        } catch (exception) {
            onLoadError(name);
        }
    else {
            run();
    }
}

Cool!

Technorati Tags: , , , , , , ,

Post new comment

The content of this field is kept private and will not be shown publicly.