0

I implemented the code from this solution: Adding a scrollbar to a group of widgets in Tkinter I use it basically as a console displaying messages etc. I need the same effect as for the text widget using

self.textwidget.see(END)

Meaning the frame would follow the widget on the bottom. I tried using focus() on the bottom widget, but that didn't work and made it look really wierd.

SIDE NOTE:

In Bryan Oakley's solution when scrolling the widgets they bleed over the canvas. To fix it place the canvas into another frame which has the same size. In his solution it can't be seen too well, but using let's say sunken relief it is truly disturbing. Also then use the relief on the outer frame not the canvas.

Community
  • 1
  • 1
Jozef Méry
  • 357
  • 5
  • 15

1 Answers1

1

Call the yview_moveto method of the canvas. It takes an argument which represents what percentage of the widget should be at the top of the window. The value 1.0 guarantees that the bottom of the scrollable canvas will be in view.

the_canvas.yview_moveto(1.0)

Note that this only works after the event loop has had a chance to render the items on the screen (ie: you can't call this immediately after adding things to the frame, unless you explicitly call update)

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685