[IronPython] Python console control for WPF

Kristof Wagemans kristof.wagemans at gmail.com
Sun Jun 25 10:09:18 CEST 2006


I've been experimenting with a Python console control for WPF. The
improvements made for IronPython beta 8 make this a lot easier thanks to
several new functions on the PythonEngine: ExecuteToConsole, FormatException
and ParseInteractiveInput.

 

One of the things I need to do to communicate with a C# application is to
change the default encoding to receive non-ascii characters. For this I
execute several commands after the PythonEngine instance is created.

    

    import sys

    sys.setdefaultencoding('utf_16_le')

    del(sys)

 

Setting the default encoding seems like a good candidate for the options you
can pass to the engine while creating a new instance. It would also be
easier if I could get at the options through a PythonEngine instance.

 

I hope you're not going to remove the FilterStackFrame delegate from the
FormatException method as the comment seems to indicate. I think it's very
useful to filter my own C# application from the stack trace. Maybe you could
add an overload with just the Exception and FilterStackFrame?

 

To set a variable in the PythonEngine you need to use SetGlobal with a
SymbolId. Am I correct to use SymbolTable.StringToId(name) to generate a
SymbolId? It used to be easier with just a string to specify the name.

 

A useful enhancement for the PythonEngine might be if there was a way to
directly call a Python function loaded in the engine and pass parameters to
it and get the return value. You could also support out parameters similar
to calling a method through reflection.

 

If you want to specify that a number is a long you can write 10L. Is there a
way to specify that a number is a double or a decimal?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060625/ad66621f/attachment.html>


More information about the Ironpython-users mailing list