1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Calling a C# library from python

Discussão em 'Python' iniciado por Stack, Abril 9, 2025.

  1. Stack

    Stack Membro Participativo

    Anyone can share a working example on how to call a simple C# library (actually its WPF) from python code? (I have tried using IronPython and had too much trouble with unsupported CPython library my python code is using so I thought of trying the other way around and calling my C# code from Python).

    Here is the example I was playing with:

    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 is a WPF windows that plots an Ellipse

    I don't know how to call this code from my python all. Any suggestions?

    Continue reading...

Compartilhe esta Página