How to scroll automatically within a Tkinter message window How to scroll automatically within a Tkinter message window tkinter tkinter

How to scroll automatically within a Tkinter message window


Add a statement cls.text.see(Tkinter.END) right after the one calling insert.


To those who might want to try binding:

def callback():    text.see(END)    text.edit_modified(0)text.bind('<<Modified>>', callback)

Just be careful. As @BryanOakley pointed out, the Modified virtual event is only called once until it is reset. Consider below:

import Tkinter as tkdef showEnd(event):    text.see(tk.END)    text.edit_modified(0) #IMPORTANT - or <<Modified>> will not be called later.if __name__ == '__main__':    root= tk.Tk()    text=tk.Text(root, wrap=tk.WORD, height=5)    text.insert(tk.END, "Can\nThis\nShow\nThe\nEnd\nor\nam\nI\nmissing\nsomething")    text.edit_modified(0) #IMPORTANT - or <<Modified>> will not be called later.    text.pack()    text.bind('<<Modified>>',showEnd)    button=tk.Button(text='Show End',command = lambda : text.see(tk.END))    button.pack()    root.mainloop()