[IronPython] Guru question: Events as a method for invoking Python from C#?

Gutfreund, Yechezkal ygutfreund at draper.com
Thu Dec 21 16:51:30 CET 2006


I am embedding Microsoft Virtual Earth into a WPF project that uses
python as the scripting language.
VE must run as a webcontrol.
 
Tasks that I have completed:
 
1. Creating the XAML wrapper
2. Embed the WebControl object in the XAML 
3. loading XAML with the Avalon module from the Python tutorials
4. Using .InvokeScript() to call Jscript routines inside the web control
and having VirtualEarth respond
 
What I am having trouble with is passing information back from
VirtualEarth to Python. 
the HTML object in JScript supports calling functions in the outer
wrapper with:
 
windows.external.somefunction(...);
 
If class that holds somefunction() is decorated with [Com(visible=true)]
then all works. The issue is that Python classes and functions are not
(and probably cannot) be made [Com(visible=true)] (they are need to be
dynamically added and changed.
 
What I am considering is having a C# lib that Python loads that contains
an "interceptor" class. This class would receive the calls from Jscript,
packages them into events and then trigger the event so that python can
receive them.
 
Questions:
1) Do any IronPython or .NET gurus here see an show stoppers with this
approach?
2) Are there any technical "gotcha's" I should look out for?
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20061221/a5197122/attachment.html>


More information about the Ironpython-users mailing list