任何人都可以分享一个关于如何从 python 代码调用简单 C# 库(实际上是它的 WPF)的工作示例?(我尝试过使用 IronPython 并且在我的 python 代码正在使用的不受支持的 CPython 库上遇到了太多麻烦,所以我想尝试另一种方式并从 Python 调用我的 C# 代码)。
这是我正在玩的示例:
using System.Runtime.InteropServices;
using System.EnterpriseServices;
namespace DataViewerLibrary
{
public interface ISimpleProvider
{
[DispIdAttribute(0)]
void Start();
}
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
public class PlotData : ServicedComponent, ISimpleProvider
{
public void Start()
{
Plot plotter = new Plot();
plotter.ShowDialog();
}
}
}
Plotter 是一个绘制椭圆的 WPF 窗口
我不知道如何从我的 python 中调用这段代码。有什么建议么?