How can I embed ironpython console in my form?

I want to create winform using C # and add a console console device to it, such as a multi-line text field. Therefore, I can write a python program to perform some operations in my Winform software.

How can i do this? Thank.

affixture:

I created an open source project IpyIF, an interactive Ironpython window. http://ipyiw.codeplex.com/

+3
source share
2 answers

Many thanks. I got it myself.

I am using two TextBox, one for inputting ironpython code, the other for redirecting ironpython output.

- , , : stdout IronPython #?

0

, .

Quickstart: "script". IronPython, IronPython.Modules, Microsoft.Scripting Microsoft.Scripting.Core .

ScriptRuntime runtime = IronPython.Hosting.Python.CreateRuntime();
ScriptScope scope = runtime.GetEngine("py").CreateScope();
ScriptSource source = engine.CreateScriptSourceFromString(script,
                                  Microsoft.Scripting.SourceCodeKind.Statements);
source.Execute(scope);

a CodePlex-Samples

+2

Source: https://habr.com/ru/post/1750259/


All Articles