Using .NET Framework Classes

From IronPython Cookbook

To access classes from the .NET framework, your application must have a reference to the assemblies you want to use. The IronPython engine already has a reference to the System assembly (unsurprisingly), but you will need to explicitly add references to other assemblies.

You do this using the clr module:

import clr
clr.AddReference('System.Windows.Forms')

Having added the reference, you can import from the namespace inside the assembly. Usually this will have the same name as the assembly.

from System.Windows.Forms import *


Back to Contents.

TOOLBOX
LANGUAGES