Python in Your Browser

An Interactive Interpreter with Silverlight

Interactive Interpreter in the Browser

 

 

An Interactive Interpreter in the Browser

An interactive Python interpreter that runs in the browser, using Silverlight and IronPython.

This is ideal for tutorials and documentation, where example Python code can actually be tried in the browser. The demo has some examples 'built in' that demonstrate one way it could be used.

It requires Silverlight 2 or more recent, and the Python version is 2.6.

The interpreter runs in an HTML textarea, with Javascript that communicates with Silverlight and prevents you deleting text from the console except after the interactive prompt.

Target browsers are Firefox 2 & 3, Safari and IE 7 & 8. (It won't work in other browsers until there is a version of Silverlight that works with them.)

The project is a combination of IronPython (for the interpreter loop), Javascript (for the 'console behaviour' in the textarea) and C# (as a helper to call into Silverlight from Javascript). On every keypress Javascript calls into IronPython (via the C#!). If the keypress is an 'enter', then it pushes the current line into the interpreter loop (which uses the standard library code module). Stdout is diverted to print into the textarea, where tracebacks are also sent. If you are attempting to type over, or delete, previous output then the keypress is cancelled.

Silverlight is available for Windows and Mac OS X, with the Firefox, Safari, Chrome or IE browsers. Linux support is via the Moonlight project from Mono.

For buying techie books, science fiction, computer hardware or the latest gadgets: visit The Voidspace Amazon Store.

Hosted by Webfaction

Return to Top

Page rendered with rest2web the Site Builder

Last edited Sat Aug 14 14:30:03 2010.

Counter...