[Tkinter-discuss] simple scrollbar... not so simple

Sorin Schwimmer sxn02 at yahoo.com
Wed Nov 24 07:16:11 CET 2010


Hi all,

I have a list of checkboxes and label/entry pairs which I'd like to have in a scrollable widget.

So I built something like this (in this example I put just labels):

from Tkinter import *

r=Tk()
tx=Text(r) # hosts the frames and allows scrollbar
sb=Scrollbar(r,command=tx.yview)
tx['yscrollcommand']=sb.set
f=Frame(tx) # hosts my stuff
f.grid()
tx.grid()
sb.grid(row=0,column=1,sticky=NS)
for i in range(50):
  Label(f,text=('line #%d' % i)).grid()
	
r.mainloop()

The scrollbar appears, but is inactive (grayed out), and has no slider.

What am I missing?

Thanks,
SxN




More information about the Tkinter-discuss mailing list