I started to complete the design, but the teacher said that the tool must have an interface, so I started looking for python to do the interface... I had done the C# interface before, and the interface was completed soon after pulling and dragging. Later, I checked IronPython. The python interpreter written in C# can also be pulled and pulled as an interface, so I started to try it. I just got a small window, and I have a few troublesome solutions to share.
(It also provides a convenient interface for the majority of students who use python to complete the design... Only for students who do not need qt, tinker, but also have a soft spot for C# pulling and pulling)
After all, I also want to pull and pull like this → https://jingyan.baidu.com/article/fd8044fac3c3d05030137a49.html
First download ironpython
http://ironpython.net/download/
Then after installing and configuring the environment variables , just look at python's pictures and do it like a tiger:
https://jingyan.baidu.com/article/48206aeafdcf2a216ad6b316.html
Open vs2017, use any python solution, and then add the ironpython WPF project (not the file) [PS: The ironpython application project is C# as the interface language, but I don't know why it is not pulled and pulled]
(The levels are:) Solutions, Projects, Environments, References, Files.
New is the level of the highlighted item ↓
There is a little trouble here, the ironpython environment is missing
(Tutorial found) Building an ironpython runtime environment in vs2012 https://blog.csdn.net/yoryky/article/details/40585875
As a result, my vs2017 can't find the C# project, so I can browse the place to add references==
Only projects and assemblies == ..., no browsing ↑
Then start directly from the environment and read the help link of vs:
https://docs.microsoft.com/zh-cn/visualstudio/python/managing-python-environments-in-visual-studio#selecting-and-installing-python-interpreters
https://docs.microsoft.com/zh-cn/visualstudio/python/managing-python-environments-in-visual-studio#manually-identifying-an-existing-environment
Change the environment directly!
Right-click the project to view all python environments↑
↑Click to open this product (remember to scroll down the scroll wheel, it took me a few minutes to find this "+custom"), then click "+custom"
Everyone, follow the gourd and draw the scoop. After setting the "prefix path", click the automatic detection to the right to save some trouble.
No change, don't panic, right click on the project, click add delete python
Check it (multi-version python recommends writing projects separately in a solution...because I'm not free to switch language versions based on scripts...)
Don't forget to set the ironpython project as the startup project↓ ( the thickened one is the startup project)
Similarly, set the code (with an empty window by default) as the startup file ( make it bold! )
ctrl+F5 to run, the window can appear
Some useful links about ironpython
http://www.voidspace.org.uk/ironpython/winforms/index.shtml————ironpython makes a simple image browser
http://www.jb51.net/article/98384.htm————c# learning 30 minutes to learn XAML (interface language)
https://www.cnblogs.com/BABLOVE/p/3234035.html———— WPF Window object (my xaml's window tag always shows "invalid tag")
https://blog.csdn.net/yoryky /article/details/40585875————C# project build ironpython
https://www.cnblogs.com/erickwan/p/6610035.html————Introduction to IronPython
https://www.cnblogs.com/Cajon/archive/2008/07/26/access_clr_object_in_python.html————Add CLR object to the runtime environment
http://ironpython.net/documentation/dotnet/dotnet.html————Introduction to each package on the official website
https://www.cnblogs.com/mq0036/p/5014250.html————I don't understand too much...