[Tkinter-discuss] Posible SPAM: simple scrollbar... not so simple

Michael O'Donnell michael.odonnell at uam.es
Wed Nov 24 08:58:10 CET 2010


Hi Sorin,

  I gave up trying to get scrolling frames to work.

Much simpler to do it with a Text widget. E.g,
for a Text item WGT and a Button item btn:

    btn=Button(WGT, text="Do it", cmd=self.someCmd)
    WGT.window_create(END, window=btn)

With this method, pack is not needed. The parent of the widgets
that you place in the Text widget needs to be the Text widget.

Mick

On Wed, Nov 24, 2010 at 7:16 AM, Sorin Schwimmer <sxn02 at yahoo.com> wrote:
> 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
>
>
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>


More information about the Tkinter-discuss mailing list