|Perl Monk, Perl Meditation|
Auto-scrolling scrollbars with Perl Tkby Ovid (Cardinal)
|on Jul 01, 2002 at 19:12 UTC||Need Help??|
Ovid has asked for the
wisdom of the Perl Monks concerning the following question:
I have some "Text" widgets that are created with Tk. I've figured out how to add scrollbars, but it the data printed to the text area goes off the bottom of the text area, the user must grab the scrollbar (or click the down arrow or the trough) to see the new data. What I would like to do is have the Text widget automatically scroll down as new data is added. Here's how I create the Text widget with a scrollbar.
That works fine, but this is what I thought was necessary to get the Text widget to "auto" scroll:
That has no apparent affect. Further, the user must move their mouse over the scrollbar to even have the scrollbar's length be correct. In other words, as soon as enough text shows up to mandate a scrollbar, the scrollbar appears, but the bar is the full height of the text area. Only when you do a mouseover does the scrollbar shrink to its correct size.
Hope this made sense :)
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.