Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Text scroll down automatically whenever text overcomes the visual area?

Let's say I have a text widget called self.txt. I also have a scrollbar, called scroll.

I have configured the scrollbar to work with self.txt, but I need the Text widget to stay scrolled down, whenever text gets added to it.

Is this doable?

like image 404
IPDGino Avatar asked Mar 24 '23 07:03

IPDGino


1 Answers

I think this should work: every time the text is modified, this should be called:

def modified(self, event):
    self.txt.see(END)  # tkinter.END if you use namespaces

To catch the modification, use:

self.txt.bind('<<Modified>>', self.modified)
like image 59
Peter Varo Avatar answered Apr 06 '23 12:04

Peter Varo