Saturday, December 15, 2012

Brython: browser Python (script type="text/python")


Seen via a tweet by @holdenweb.

Brython

Excerpt:

(   Brython is designed to replace Javascript as the scripting language for the Web. As such, it is a Python implementation (you can take it for a test drive through a web console), adapted to the HTML5 environment, that is to say with an interface to the DOM objects and events

The gallery highlights a few of the possibilities, from creating simple document elements to drag and drop and 3D navigation  )

It has a console so you can try it.

Some Python features are not supported, such as classes. You have to use 'log' instead of 'print'.

Screenshot of Python code running in brython console (by @holdenweb):

http://twitpic.com/bm4lq7

I tried the same for loop in Brython console from my Android phone and it worked. But when I modified the log function expression, I got what seems to be wrong results. Investigating  ...

An article with more details on using brython and how it works (it converts Python to JavaScript):

http://raspberry-python.blogspot.com/2012/12/brython-browser-python.html

- Vasudev Ram
www.dancingbison.com

No comments: