Tkinter Scrollbar not working
Martin Franklin
mfranklin1 at gatwick.westerngeco.slb.com
Tue Jan 3 04:10:59 EST 2006
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)
## import all names from Tkinter
## bit naughty but I don't mind
from Tkinter import *
# root window
root=Tk()
# text area
text=Text()
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
root.mainloop()
More information about the Python-list
mailing list