[IronPython] Users Digest, Vol 82, Issue 6

Bill Dines wdines at longview.com
Wed May 11 16:12:04 CEST 2011


Hi,

the hosting system in the DLR seems to be responsible for IronPython
classes to make known in the dotNet world. For me as a beginner in
IronPython and Silverlight is not as easy to understand.
How do I get in a pure iron python / Silverlight application (generated
with sl.bat) the Python engine?
My goal would be to create a code behind file. I would have more
opportunities to program Silverlight IronPython.

Thanks in advance for answering,
Greetings

Sven

Hi Sven,

Finding out about how to get Silverlight and IronPython working together
is quite tricky as the documentation is incomplete where it exists at
all.  I've been working on it for some time now and am starting to get
an idea of what you can do.  I am also using python as codebehind to
Silverlight controls and pages so it's definitely possible.  In fact
Silverlight/python (or ruby) is a compelling combination that is in many
ways superior to Silverlight/c#.  I am surprised more people aren't
pursuing it.

I would suggest the best place to start would be to install PTVS (from
http://pytools.codeplex.com/), which is more mature and robust than the
VS tools included with ironpython.  Note that you will need to uninstall
the ironpython VS tools first.

PTVS provides a Silverlight project template that lets you embed python
scripts in an html page but I don't think this is really what you want.
However you can create proper IronPython/Silverlight applications
relatively easily, there is just no template or documentation for it for
some reason. See the workaround suggested (by me:)) in this feature
request: http://pytools.codeplex.com/workitem/34.  Once you have that
working you should be able to achieve python codebehind.  I am doing it
using some Silverlight plumbing that reads in .xaml files (using
XamlReader.Load(<xamlstring>)) and then executes a codebehind .xaml.py
file with the same name.  You could do it with pure python though if you
want.

I have to be honest and say that it's probably not going to be
especially easy if you are a beginner in both python and Silverlight
because the documentation is so poor...

Anyway, hope that helps a bit and good luck.

Bill



More information about the Ironpython-users mailing list