Tkinter Scrollbar not working
DustanGroups at gmail.com
Tue Jan 3 07:47:05 EST 2006
Martin Franklin wrote:
> Dustan wrote:
> > I'm trying to get a scrollbar bound with a Frame, and I keep on getting
> > a scrollbar, but it doesn't actually scroll. Some help, please?
> It can be tricky getting an empty frame to scroll, can you post your
> example code so that we might be more helpful. Here is an example of
> binding a scroll bar to a Text widget (not exactly the same thing)
It's not an empty frame. It has a label. I was trying to do it with
just the label, but it didn't work, and I figured it might be a better
idea to try doing it with a frame instead.
> ## import all names from Tkinter
> ## bit naughty but I don't mind
> from Tkinter import *
> # root window
> # text area
> text.pack(side="left", expand="yes", fill="both")
> # scrolbar for above textarea
> sb = Scrollbar(root)
> sb.pack(side="right", fill="y")
> ## bind them both together...
> # this line binds the yscrollcommand
> # of the text area to the scrollbar set method
> text['yscrollcommand'] = sb.set
> # this line binds the scrollbars command to
> # the yview method of the text area
> sb['command'] = text.yview
> # mainloop entry
That doesn't help. I need to be able to do it either with a frame (has
content!) or a Text widget.
More information about the Python-list