[Tutor] howto call DOM with python

Bob Gailer bgailer at alum.rpi.edu
Thu Mar 1 03:29:56 CET 2007


Ismael Farfán Estrada wrote:
> hi there
>
> I was wondering wheter someone knows how to use python to write
> a client-side scripts like if it were java, I want to get someting like
> this working
> <html>
> <script type="text/python">
> window.alert("python")
> </script>
> </html>
>
> but nothing happens. I don't know javascript but this code works
> if I put javascript instead of python, I've also tried with pythonscript
> python-source, etc
>
> hope you can help me, I'm using GNU/Suse, Opera, and Firefox for test
>   
As others have pointed out, browsers only know JavaScript. But take a 
look at pyjamas: http://pyjamas.pyworks.org/ which translates Python 
into browser-specific JavaScript. It is designed around a Python port of 
Google Web Toolkit, but you don't need to use that aspect of it. Of 
course the ability to create web pages using the ported GWT widgets is 
pretty impressive. No more HTML!

Take a look at the pyjamas helloworld example.

-- 
Bob Gailer
510-978-4454



More information about the Tutor mailing list