Click here to Skip to main content
15,886,055 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have recently started to learn Python as some structures of the language make it far easier to solve some programming issues that I need to face. However, I want to integrate it with windows forms for user interaction. This mostly is around inputs, which are then passed to the python code. I am using Visual Studio 2012 as my IDE.

I have used Google to find examples of how to do this but I haven't found anything particularly useful or well written. Does anyone have suggested links or sample code they can share to do this?

Thanks in advance,
John.
Posted
Comments
Sergey Alexandrovich Kryukov 5-Dec-12 22:01pm    
Do you mean .NET System.Window.Forms?
--SA
jgrogan 6-Dec-12 3:51am    
Hi Sergey - yes I do.
Sergey Alexandrovich Kryukov 6-Dec-12 14:49pm    
Please add the tag "Forms"; you are the one who is interested the most.
--SA

1 solution

Check out Python for .NET: and Iron Python:
http://sourceforge.net/projects/pythonnet/files/[^],
http://en.wikipedia.org/wiki/Iron_Python[^],
http://ironpython.net/[^].

You can also use command-line Python interpreter in you application running it through System.Diagnostics.Process.Start. You will need to redirect the streams StandardInput, StandardOutput and StandardError and work with the Python application through these streams.

Please see:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx[^],
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardinput.aspx[^],
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardoutput.aspx[^].

Two last MSDN articles referenced above show code samples for redirection.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900