Python和Win Forms [英] Python and Win Forms
问题描述
我最近开始学习Python,因为语言的一些结构使我更容易解决我需要面对的一些编程问题。但是,我想将它与Windows窗体集成以进行用户交互。这主要是围绕输入,然后传递给python代码。我正在使用Visual Studio 2012作为我的IDE。
我用谷歌找到了如何做到这一点的例子,但我没有找到任何特别有用或者很好的例子书面。有没有人有他们可以分享的建议链接或示例代码?
提前致谢,
John。
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.
推荐答案
查看Python for .NET:和Iron Python:
http://sourceforge.net/projects/pythonnet/files/ [ ^ ],
http://en.wikipedia.org/wiki/ Iron_Python [ ^ ],
http://ironpython.net/ [ ^ ]。
您还可以在运行它的应用程序中使用命令行Python解释器System.Diagnostics.Process.Start
。您需要重定向流StandardInput
,StandardOutput
和StandardError
并通过这些流使用Python应用程序。
请参阅:
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/sy stem.diagnostics.process.standardoutput.aspx [ ^ ]。
上面引用的两篇MSDN文章显示了重定向的代码示例。
-SA
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 throughSystem.Diagnostics.Process.Start
. You will need to redirect the streamsStandardInput
,StandardOutput
andStandardError
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
这篇关于Python和Win Forms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!