I have a GUI in VB.Net that needs to interface with algorithms written in Python, all to run on Windows 10 Professional. The IDE is Visual Studio 2017.
How can the VB.Net GUI and Python communicate? Data needs to be communicated back and forth. The GUI will accept user commands, and then command Python to execute. Python will have events that it needs to communicate to the GUI.
To clarify the architecture, the GUI app and the Python app are two different programs running simultaneously.
The GUI has two major functions: 1) take user commands and tell Python to execute them. 2) Monitor/poll the Python app for data or events, and update (tell) the user via the GUI controls (textboxes, etc.).
Python mainly does two things: 1) runs the continuous control algorithm, subject to management by the GUI. 2) Reports data and events to the GUI.
A TCP socket is 100% reliable, but I have to write and debug a proprietary messaging scheme, which I've done a lot and it's fun, but I thought maybe I can accomplish same thing in substantially less time by some other equally reliable method... such as COM, as those below suggest.
Example scenario of asynchronous usage:
1:
The Python app is running a robotic process. Meanwhile, user presses GUI command to see latest metrics: GUI's VB.NET calls a COM function within Python which returns an array of metrics data.
2:
Python app running robotic process completes a step, and now needs a manual action. Python app calls COM function within VB.NET and passes an argument with requirements of manual action.