I read through many of solutions of this problem already, but I still can't make this simple program work. I know it's probably really simple, but I can't find out what am I missing.
I have this simple program:
from Tkinter import *
import subprocess
def run():
process=subprocess.Popen(some_script, shell=True, stdout=subprocess.PIPE)
while True:
nextline = process.stdout.readline()
if not nextline:
break
output.set(nextline)
root.update_idletasks()
root = Tk()
output = StringVar()
label1 = Label(root, textvariable=output)
label1.pack()
button1 = Button(root, text="Go", command=run)
button1.pack()
root.mainloop()
So when I click the button, some_script is executed. I want the label to periodically update with the output of the script, but it doesn't. What am I doing wrong?