Hi everybody,

i try to come to grips with PyJS and its components. 
I want to create a javascript file with pyjs and include it into a html 
document and access its functions from the html file.

If I understand correctly pyjampiler would be the tool of choice for that 
purpose.
I've created a minimal example to describe this scenario

hello.html:

<html>
    <head>
        <script src="Hello.js" type="text/javascript"></script> 
    </head>
    <body>
        <button onclick="greet()"> greeting </button>
    </body>
</html>

hello.py:

def greet():
    alert("Hello World")

run pyjampiler cmd:    
../../pyjamas_81a/bin/pyjampiler -r Hello.py -o Hello.js 


firefox when click the button:
$pyjs.loaded_modules['Hello.py'] is not a function @ 
file:///home/silentrunner/python/pyjs_canvas/hello_world/Hello.js:794

chromium:
Uncaught TypeError: Object #<Object> has no method 'Hello.py' Hello.js:794
(anonymous function)

when click the button:
Uncaught ReferenceError: greet is not defined 

if i replace Hello.js with handwritten JS the example works:

function greet(){
        alert('Hello World')
    }

Thanx in advanced

-- 



Reply via email to