I' trying to get mouse coords from Python event in C#. I call my python script from C#, it open a python window, i click on my thumbnails on python window and need to get mouse pos from thumbnails and use it in C# program. This solution works only after i close Python window.I get all the values at this moment...but i need to get these values each time after a click on thumbnails in Python window. I had tried a lot of solutions, but i think the StreamReader read only after Python window is closed.
Here's my python code:
class myClass(object):
def mouse_click(self, event):
xs, ys = event.xdata, event.ydata
print('%s, %s' % (xs, ys))
Here's my C# code :
private void btOK_Click(object sender, EventArgs e)
{
start = new ProcessStartInfo();
start.FileName = "C:\\Python27\\python.exe";
start.Arguments = "C:\\myfolder\\myfile.py";
start.UseShellExecute = false;
start.RedirectStandardOutput = true;
using (Process process = Process.Start(start))
{
using (StreamReader reader = process.StandardOutput)
{
string result = reader.ReadToEnd();
Console.Write(result);
}
}
}