VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > VB.net教程 >
  • 从vb.net执行python脚本

How I could execute a python script from within the VB.NET code?

I would like to use VB.NET for building a GUI for my python script.

This is to be able to create a GUI for the user of a script.

I found this example:

Shell(c:\Program Files\python 266\python.exe path\myPythonScript.py +

" " + arg1 + " " + argN)

But I would like to know is there a more suitable way of executing python script?

I would also like to understand how I could handle errors in such setup.

Your help much appreciated!

Thanks,

meryloo

解决方案

You could call python from within .NET but if the only reason you want to do that is because you want to design a GUI fro your Python, why not keep things 'cleaner' and do it all in Python? You can use TKInter or wxPython to name but two GUI APIs. The latter also has wxDesign which can lighten the load of GUI design.

This list gives you some more options for GUI design in Python other than the two I've listed.

On the other hand, you don't say what you are developing that needs python, but if it is either for ArcGIS or GDAL (probably the two most common GIS scripting environments) both of those have .NET APIs as well as Python. So, you could potentially do it ALL in .NET.

 
出处:https://blog.csdn.net/weixin_32160507/article/details/118793074?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522164955625716782092918260%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=164955625716782092918260&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~rank_v31_ecpm-9-118793074.nonecase&utm_term=VB.net&spm=1018.2226.3001.4450


相关教程