Generally speaking you want to do 2 things:
1. Wire up std out / std err to a stream you can send to your window.
You can do this via
PythonEngine.SetStandardOutput/PythonEngine.SetStandardInput. You could also
wire up std-in but that'll be less important (it's only going to matter if
someone calls something like raw_input).
2. When you get input from the user call
PythonEngine.ExecuteToConsole("input")
Between those two you should have your console up and running. The IConsole
interface is actually just used by the command line implementation and isn't
part of the hosting APIs. That's why you're not finding it anywhere on the
engine - the linked blog came before IronPython 1.0.
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jon Cooper
Sent: Wednesday, January 23, 2008 5:02 AM
To: [email protected]
Subject: [IronPython] WinForms UserComponent binding a IronPythonConsole
Hello,
I've been enjoying using IronPython.
I'm now going to embed it in my C# WinForms application to provide a way for
users to perform simple ad-hoc scripting. Unfortunately this has been less easy
than I thought it would be!
I've built a subclass of TextBox that I can use to display and input the text
coming to/from my user. Now I just need to connect it to a PythonEngine.
In the article at
http://blogs.msdn.com/jmstall/archive/2005/09/01/Howto_embed_ironpython.aspx,
one gets the impression that a PythonEngine has a MyConsole property where one
can connect an IConsole. Perfect! Unfortunately, that's not the case on my 1.1
build.
Digging through the source I find that this stuff exists on IronPythonConsole,
but that class appears to be designed for use statically.
Before I go to the trouble of ripping apart IronPythonConsole and likely
reinventing the wheel, is there something I'm missing here?
Thanks,
jon
________________________________
Arrowgrass Capital Partners (US) LP is a limited partnership registered in the
State of Delaware.
This message is for the named person's use only. It may contain confidential,
proprietary or legally privileged information. No confidentiality or privilege
is waived or lost by any transmission errors. If you receive this message in
error, please immediately delete it and all copies of it from your system,
destroy any hard copies of it and notify the sender. You must not, directly or
indirectly, use, disclose, distribute, print, or copy any part of this message
if you are not the intended recipient.
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com