I have a Vb.net program that runs python script in the background. I want a get the python input questions input("Enter num"). I would like to get this so I can get users to input values before writing tothe python StandardInput
VB.NET
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Controls.Add(TextBox1)
Dim p As Process = New Process
p.StartInfo.FileName = "C:\Users\luqma\AppData\Local\Programs\Python\Python38-32\python.exe" 'Default Python Installation
p.StartInfo.Arguments = "File.py"
p.StartInfo.UseShellExecute = False 'required for redirect.
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden 'don't show commandprompt.
p.StartInfo.CreateNoWindow = True
p.StartInfo.RedirectStandardInput = True
p.StartInfo.RedirectStandardOutput = True 'captures output from commandprompt.
p.StartInfo.RedirectStandardError = True
p.Start()
Dim reader As StreamReader = p.StandardOutput
Dim myStreamwrite As StreamWriter = p.StandardInput
Dim onlyValue As Int32
Dim part1 As String
Dim part2 As String
onlyValue = 1
While Not p.StandardOutput.EndOfStream
Dim output As String = reader.ReadLine
If myStreamwrite.BaseStream.CanWrite Then
myStreamwrite.WriteLine(1)
TextBox1.Text += Environment.NewLine + ">>>" + output + Environment.NewLine
Else
TextBox1.Text += Environment.NewLine + ">>>" + output + Environment.NewLine
End If
End While
Python - I want to ask users what's in the bracket so they can input the values
b = int(input("Enter num:"))#RUNS WHEN THERE IS ONLY THIS INPUT