IronPython & Silverlight 2 Tutorial with Demos and Downloads

Hello all,

My first post to the IronRuby list, sorry it is mainly about IronPython
(and sorry for the HTML in the post - I plead special circumstances and
won’t do it again).

I’ve just put up articles and demos based on my PyCon talk about Dynamic
Silverlight. All the examples use Python, but the articles on packaging,
embedding in C#, compiling from the command line and using the
Silverlight APIs are all relevant.

These articles also include the Interactive Python Interpreter in the
browser that Harry Pierson mentioned. (It won’t work properly until the
Python binaries from Dynamic Silverlight have a bugfixed and I fix the
Javascript to work in browsers other than Silverlight). The interpreter
is based on a Python standard library module called ‘code’ (
http://docs.python.org/lib/module-code.html ) - so it won’t port
directly to Ruby. On the other hand there is no reason why a similar
app. shouldn’t be written in Ruby (and the Javascript would be useful
for providing a console in a textarea).

Michael

IronPython & Silverlight 2 Tutorial with Demos and Downloads

Instead of posting my PyCon talk slides, I’ve turned them into a series
of articles instead, which should be easier to follow. All the examples
are available online and for download. This is everything you need to
get started with IronPython and Silverlight 2.

All the articles, demos and downloads can be found at: Voidspace
IronPython and Silverlight Pages
http://www.voidspace.org.uk/ironpython/silverlight/index.shtml.

You can experiment online with the IronPython & Silverlight Web IDE
http://www.voidspace.org.uk/ironpython/webide/webide.html.

There is also a prototype of my Interactive Python Interpreter in the
Browser
http://www.voidspace.org.uk/ironpython/silverlight/interactive.shtml.
Due to a bug in the /current/ Dynamic Silverlight binaries it can’t
handle indented blocks. I expect Dino will be able to post fixed
binaries soon. If you want to help me make the Javascript cross-browser
then get in touch! (Currently it is safari only I think.)

  The Articles

These articles will take you through everything you need to know to
write Silverlight applications with IronPython:

*

  Introduction to IronPython & Silverlight 2
  <http://www.voidspace.org.uk/ironpython/silverlight/introduction.shtml>

*

  The Structure and Contents of a Dynamic Silverlight Application
  <http://www.voidspace.org.uk/ironpython/silverlight/silverlight_application.shtml>

*

  Getting Started: Minimal Examples of IronPython and Silverlight
  <http://www.voidspace.org.uk/ironpython/silverlight/minimal.shtml>

*

  The Silverlight APIs
  <http://www.voidspace.org.uk/ironpython/silverlight/silverlight_api.shtml>

      Exploring the Core-CLR that comes with Silverlight. This
      includes accessing the browser DOM, working with XAML,
      creating controls, the video player, accessing server
      resources, using local storage and more.

*

  From Silverlight to Javascript and Back Again
  <http://www.voidspace.org.uk/ironpython/silverlight/scriptable.shtml>

      Interacting with Javascript from IronPython code is easy, but
      needs a bit of C#. This article shows you how to do it -
      including compiling the C# from the command line (without
      Visual Studio installed).

*

  Embedding IronPython in a C# Silverlight Application
  <http://www.voidspace.org.uk/ironpython/silverlight/embedding_ironpython.shtml>

*

  Interactive Python Interpreter in the Browser
  <http://www.voidspace.org.uk/ironpython/silverlight/interactive.shtml>

      An interactive Python interpreter that runs in the browser,
      inside an HTML textarea. Great for documentation and tutorials
      where you can try the code in the browser.


  Downloads & Online Examples

You can download several of the examples used in the articles:

* View Minimal IronPython Example 1 Online (with XAML)
  <http://www.voidspace.org.uk/ironpython/minimal/index.html>
* Download Minimal IronPython Example 1
  <http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?section=python&file=MinimalIronPythonProject.zip>
* View Minimal IronPython Example 2 Online (pure-Python)
  <http://www.voidspace.org.uk/ironpython/minimal2/index.html>
* Download Minimal IronPython Example 2
  <http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?section=python&file=MinimalIronPythonProject2.zip>
* View IronPython Controls Example 1 Online (from XAML)
  <http://www.voidspace.org.uk/ironpython/controls/index.html>
* Download IronPython Controls Example 1
  <http://www.voidspace.org.uk//cgi-bin/voidspace/downman.py?section=python&file=IronPython-Controls.zip>
* View IronPython Controls Example 2 Online
  <http://www.voidspace.org.uk/ironpython/controls2/index.html>
* Download IronPython Controls Example 2
  <http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?section=python&file=IronPython-Controls2.zip>
* View Simple Animation Example Online
  <http://www.voidspace.org.uk/ironpython/animation/index.html>
* Download Simple Animation Example
  <http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?section=python&file=IronPython-animation.zip>

The easiest way of experimenting with the Silverlight APIs is through
the Web IDE:

* View IronPython & Silverlight Web IDE Online
  <http://www.voidspace.org.uk/ironpython/webide/webide.html>.
* Download IronPython & Silverlight Web IDE 0.5.0
  <http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?section=python&file=webide.zip>.

The following downloads use C#:

* Visual Studio 2008 Project Using the Scriptable Attributes
  <http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?section=python&file=ScriptableProject.zip>
* Compiling C# from the Command Line (batch file)
  <http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?section=python&file=csl.bat>
* Embedded IronPython Project
  <http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?section=python&file=EmbeddedWithCodeBehind.zip>

One of the most exciting things about Silverlight 2 is the possibility
of embedding an interactive interpreter inside web pages:

* View Interactive Interpreter Online
  <http://www.voidspace.org.uk/ironpython/silverlight-console/console.html>
* Download Interactive Interpreter
  <http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?section=python&file=interpreter.zip>

If you find any bugs, typos or missing links then please let me know.

Posted by Fuzzyman on 2008-03-22 19:03:34.
Categories: Writing
http://www.voidspace.org.uk/python/weblog/arch_Writing.shtml, Python
http://www.voidspace.org.uk/python/weblog/arch_Python.shtml,
IronPython
http://www.voidspace.org.uk/python/weblog/arch_IronPython.shtml
Visit the Voidspace Techie Blog
http://www.voidspace.org.uk/python/weblog/index.shtml to read this
entry and more.

Hello,

I think the above links were not placed properly and hence shows errors.

I one again place the working links…

http://www.voidspace.org.uk/ironpython/silverlight/interactive.shtml

http://www.voidspace.org.uk/ironpython/silverlight/introduction.shtml

http://www.voidspace.org.uk/ironpython/silverlight/index.shtml

http://www.voidspace.org.uk/ironpython/index.shtml

The whole credit goes to Mr. Michael F…

Cheers.

+1 Foord.

On Sat, Mar 22, 2008 at 10:46 PM, Rahil K. [email protected]

Matthew M. wrote:

Very nice!

Thanks

On Sat, Mar 22, 2008 at 4:03 PM, Michael F.
<[email protected] mailto:[email protected]> wrote:

[snip...]

These articles also include the Interactive Python Interpreter in
the browser that Harry Pierson mentioned. (It won't work properly
until the Python binaries from Dynamic Silverlight have a bugfixed
and I fix the Javascript to work in browsers other than Silverlight).

That should have read - ‘browsers other than safari’.

I’ve had the javascript for the ‘interpreter in the browser’ working for
both Firefox and IE - but managed to break it a while ago. Without it
working in Silverlight anyway I haven’t bothered to fix it…

Once fixed, the Javascript (and C# for communicating between JS and
Silverlight) will work with IronRuby just as well as IronPython.

The Read-Eval-Print-Loop (interactive interpreter) for Ruby you will
have to provide yourselves…

Michael
http://www.manning.com/foord

Very nice!

On Sat, Mar 22, 2008 at 4:03 PM, Michael F.
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs