I want to display standard output from python script in textbox, but after click the button nothing happend. If it's wrong how can I fix it or replace? Example I run my aplication in textbox1 i have nothing and after clicking button1 I want to have in my textbox1 'Hello' from python script
private void button1_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
char[] spliter = { '\r' };
int x = 1;
Process python = new Process();
python.StartInfo.FileName = "D:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python37_64\\python.exe";
python.StartInfo.RedirectStandardOutput = true;
python.StartInfo.UseShellExecute = false;
python.StartInfo.Arguments = string.Concat("C:\\Users\\kamil\\source\\PythonApplication3\\PythonApplication3.py", " ", x.ToString());
python.Start();
StreamReader sReader = python.StandardOutput;
string[] output = sReader.ReadToEnd().Split(spliter);
foreach (string s in output)
{
TextBox1.Text += s + Environment.NewLine;
}
python.WaitForExit();
Python script:
import sys
def main():
print('Hello')
main()