I'm trying to redirect the powershell-output into a text box in Tkinter. I specifically want the print statements from the command prompt. does anyone know how I can go about this?
I followed this but it won't print to the text box.
my final function looks like this:
def start_script():
os.system('python Script.py')
p = sub.Popen('python ./Script.py', stdout=sub.PIPE, stderr=sub.PIPE)
output, errors = p.communicate()
while True:
for line in output:
text.insert(END, line)
It might be because it runs the script and then goes to print out the while true statement but I'm just guessing. Can someone point me in the right direction please?