I have a Python 2.7 GUI using Tkinter and porting it to 3.7 It pipes a subprocess stdout to a scrolledtext widget and works fine with 2.7 but with 3.7 it is constantly updating the widget and I cannot scroll. Code snippet:
#lauch main
proc = subprocess.Popen(["python", testPath, filePath] + script_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=0)
#clear the text box widget
text.delete("1.0", END)
#check for alternate main.py
if (alt_main_flag == True):
text.insert(END, "Using alternate MAIN script in " + filePath + '\n')
#send the scripts output to the GUI text box
# for 3.x, had to use bytes() conversion prior to 'in'
for line in iter(proc.stdout.readline,''):
if (bytes("Starting ", 'ascii') in line):
line = line.strip()
statusvar.set(line)
else:
text.insert(END, line)
if (bytes("end of program", 'ascii') in line):
statusvar.set("Ready")
#update in "real time"
text.see(END)
root.update()
text.update_idletasks()
Suggestions?
Mark