1

I am writing a Windows Application using Visual Studio 2015 in C#. This is going to be a complicated engineering application that requires a lot of very intense mathematical calculations.

My friend is writing the mathematical code in a Visual Studio 2015 Python Console Application. For various reasons the mathematical code has to be written in Python.

What I want to do is somehow write an algorithm using Python and embed that algorithm into my C# Windows application. To simplify this let's say that the python algorithm takes two numbers adds them together, and returns the answer. Inside my C# app I have two textboxes on a windows form. I want to take the two numbers from the Textbox.Text and send them to my python alogrithm and return the answer to then be displayed on the Windows form Label.Text.

I'm mostly looking to not have to expect to have Python running on my end user's computer, therefore just calling the Python script is not an acceptable solution.

Can that be done?

Ken Y-N
  • 14,644
  • 21
  • 71
  • 114
  • I reviewed that post prior to asking my question. It's possible I am missing the answer there. What I am trying to say is I want to Embed this into my project. This is going to be a redistributable application. I cannot expect my end users to have python installed on their machines. From the example you have linked it appears that to execute .py files (which I could distribute in the installation package into the installation directory) but you must also be able to run python.exe. – user7159104 Jan 04 '17 at 23:02
  • The current dup is not the correct dup - [try using Cython](https://stackoverflow.com/questions/4650243/convert-python-program-to-c-c-code) to make a compilable version. – Ken Y-N Jan 05 '17 at 03:45

0 Answers0