Using Ruby and Python on Web Clients

Project Gestalt allows developers to use Ruby and Python to script their web UIs.

The project is powered by Silverlight's Dynamic Language Runtime and the IronPython and IronRuby. This means that they run under a sandboxed JIT engine.

Using it in your web pages is very simple. All you need to do is include in your web page the "gestalt.js" javascript. Once you do that, you can then embed Python or Ruby source code using <script> language="python"<script> or <script> language="ruby"<script>

<body>

<button id="say_hello">Say, Hello!</button>

<script language="python">
def OnClick(s,e):
  document.say_hello.innerHTML = "Hello, World!"
    
document.say_hello.AttachEvent("onclick", 
                   EventHandler[HtmlEventArgs](OnClick))
</script>
</body>
</html>
	

This addresses a part of Silverlight's story that I always felt was less than ideal. Without the Gestalt script, developers using Ruby or Python had to package their software on a ZIP file before sending down to the client.

Jimmy covers in more detail this important development. We both disliked the ZIP-file deployment model that Silverlight comes out of the box with.

With Gestalt developers can treat Python and Ruby on the client in the same way they have been treating HTML and Javascript. Write code, hit save, refresh page.

Check the samples.

All four pieces (Gestalt, the Dynamic Language Runtime, IronRuby and IronPython) are open source technologies that run on either Microsoft's Silverlight or our own open source Moonlight.

Posted on 22 Jul 2009 by Miguel de Icaza
This is a personal web page. Things said here do not represent the position of my employer.