I've been fighting with Tkinter for a while now and have exhausted most the resources I have for referencing this. I've found a couple similar topics here but none quite bring me to where I need to be.
I've got a long running python script and I was hoping to build a gui to interact with it some. I'm currently trying to pipe the data from the CLI back into the GUI but can't seem to get any of the data and the GUI locks when the subprocess is called.
I'm pretty new with python and on stack overflow, so I apologize if I have missed something stupid or not asked the question in the right way.
import Tkinter
from Tkinter import *
import subprocess
import sys
top = Tkinter.Tk()
def startScript():
root = Tk()
cli = subprocess.Popen(['python.exe', 'aScript.py'], shell=False, stdout=subprocess.PIPE)
root.update()
while True:
line = cli.stdout.readline()
if line == '' and process.poll() is not None:
break
print line
t.insert(tk.END, line)
B = Tkinter.Button(top, text ="Start Script", command = startScript)
B.pack()
top.mainloop()