Page 1 of 1

trying pyjamas out for the first time.

Posted: Mon Apr 04, 2011 10:36 am
by Isaac
Wow, does it produce a ton of source code!

[url removed]

This is the python code I pasted in, with a few harmless string edits.

Code: Select all


import pyjd # this is dummy in pyjs.
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.Button import Button
from pyjamas.ui.HTML import HTML
from pyjamas.ui.Label import Label
from pyjamas import Window

import pygwt

def greet(fred):
    fred.setText("YOU CLICKITH MY BUTTON!!!!")
    Window.alert("Hello, AJAX!")

if __name__ == '__main__':
    pyjd.setup("public/Hello.html?fred=foo#me")
    b = Button("Click me, for my hello world!!!", greet, StyleName='teststyle')
    h = HTML("<b>Hi there! I'm testing some code!</b> (html)", StyleName='teststyle')
    l = Label("Hello World (label)", StyleName='teststyle')
    base = HTML("Hello from %s" % pygwt.getModuleBaseURL(),
                                  StyleName='teststyle')
    RootPanel().add(b)
    RootPanel().add(h)
    RootPanel().add(l)
    RootPanel().add(base)
    pyjd.run()
Look at how much code pyjamas spat out after it compiled that small bit of python.

It's about 12 mb worth according to my chrome dev tools.

edit:
My mistake... I'm getting two different readings. One is when I do ctrl+shift+c, which gives lots of code, while right clicking and "view source code" shows 14 lines of html... Hmmm... odd.

edit:
Jeff, I'm just experimenting with pyjamas. I don't think Python is the best way to write Javascript, since that's probably what Javascript is for. And I still want to dive into Javascript, just not yet.

Re: trying pyjamas out for the first time.

Posted: Mon Apr 04, 2011 8:33 pm
by Jeff250
I've never heard of this, but generally compiling from one high-level language to another is questionable.

Re: trying pyjamas out for the first time.

Posted: Mon Apr 04, 2011 11:18 pm
by Sirius
Oh. I thought this thread would be a lot funnier than it was.

Re: trying pyjamas out for the first time.

Posted: Tue Apr 05, 2011 12:52 pm
by fliptw
javascript is best written by hand, as with pretty much any language.

Re: trying pyjamas out for the first time.

Posted: Tue Apr 05, 2011 1:56 pm
by Isaac
Plus, eclipse has so many cool toys for Javscript. I think I'm going to take to it in the same way I did Python.