On 2012-01-24 02:52, Peter Otten wrote:

Have update() (renamed to read_more() in my code) do the reading:

import sys
import tkinter
import tkinter.scrolledtext

root = tkinter.Tk()

text_window = tkinter.Toplevel()
text = tkinter.scrolledtext.ScrolledText(text_window)
text.pack()

infile = open(sys.argv[1])

def read_more():
     line = next(infile, None)
     if line is not None:
         text.insert(tkinter.END, line)
         root.after(100, read_more)
     else:
         text.insert(tkinter.END, "\nThat's all folks", "looney")
         text.tag_configure("looney", foreground="RED")
     text.see(tkinter.END)

read_more()
root.mainloop()



Thank you, this was very useful!

--
Yves.                                                  http://www.SollerS.ca/
                                                       http://ipv6.SollerS.ca
                                                       http://blog.zioup.org/
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to