PythonConsoleControlV2 1.0.0

dotnet add package PythonConsoleControlV2 --version 1.0.0
                    
NuGet\Install-Package PythonConsoleControlV2 -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PythonConsoleControlV2" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PythonConsoleControlV2" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="PythonConsoleControlV2" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PythonConsoleControlV2 --version 1.0.0
                    
#r "nuget: PythonConsoleControlV2, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PythonConsoleControlV2@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PythonConsoleControlV2&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=PythonConsoleControlV2&version=1.0.0
                    
Install as a Cake Tool

PythonConsoleControlV2 (.NET library)

PythonConsoleControlV2 is a WPF control that puts a live IronPython prompt inside your application. Drop IronPythonConsoleControl into a window and you get a REPL with syntax highlighting, code completion and command history, drawn by AvalonEdit. Hand it objects from your app and users script against them while the app runs.

Package ID PythonConsoleControlV2
Control IronPythonConsoleControl
Target frameworks net481, net10.0-windows
Runtime Windows only, WPF
Python IronPython 3.4.2
License LGPL-3.0-only

Requirements

  • Windows, with WPF.
  • .NET Framework 4.8.1 or .NET 10.
  • Nothing else to install. NuGet brings in IronPython 3.4.2 and AvalonEdit 6.3.1.

Installation

dotnet add package PythonConsoleControlV2

Or add a PackageReference:

<PackageReference Include="PythonConsoleControlV2" Version="1.0.0" />

Getting started

Declare the namespace and place the control:

<UserControl xmlns:console="clr-namespace:PythonConsoleControl;assembly=PythonConsoleControl">
    <console:IronPythonConsoleControl Name="console" />
</UserControl>

Wait for the engine, then publish your own objects into the prompt:

console.Pad.Host.ConsoleCreated += (s, e) =>
    console.Pad.Console.ConsoleInitialized += (s2, e2) =>
        console.Pad.Console.ScriptScope.SetVariable("app", myApplication);

A user now types app.Documents.Count and reads the answer against live state.

To run a script instead of a typed line, call console.Pad.Console.RunStatements(text).


Notes

Ctrl-C interrupts a running script. On .NET Framework the control aborts the worker thread. On .NET 10 Thread.Abort throws, so the control raises a flag and an IronPython trace hook stops the script at its next traced event. That hook costs a callback per event, so scripts run slower on .NET 10 than on .NET Framework.

Add the AvalonEdit highlighting definition yourself if you want colour in your own editor pane. The control highlights its own prompt buffer.


This is a fork of Joe Moorhouse's PythonConsoleControl from the IronLab project, moved to IronPython 3 and AvalonEdit 6.

© 2010 Joe Moorhouse. Modifications © 2026 Stephen S. Mitchell. Released under the GNU Lesser General Public License v3.

Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
.NET Framework net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 54 9/21/2026

v1.0.0 - First release of this fork. Moves the engine from IronPython 2.7.10 to 3.4.2. Replaces the vendored AvalonEdit 4.0.0.5949 binary with the AvalonEdit 6.3.1.120 package, which changed six call sites: PerformRectangularPaste takes a TextViewPosition, Selection.GetText and ReplaceSelectionWithText lost their arguments, IsMultiline became a property, TextArea.ClearSelection replaced Selection.Empty, and HighlightingColorizer takes an IHighlightingDefinition. Adds a .NET 10 (Windows) target beside .NET Framework 4.8.1. Ctrl-C stops a running script on both: .NET Framework aborts the worker thread, .NET 10 uses an IronPython trace hook because Thread.Abort throws there.