[Tutor] Scrolled Listbox

Abel Daniel abli@freemail.hu
Tue Feb 25 17:03:27 2003


vicki@stanfield.net (vicki@stanfield.net) wrote:
> I need a Scrolled Listbox for an application that I am
> writing. The only one I see is in PMW which appears to
> still be in beta as far as I can tell.
Well, I use it for my toy project, and it doesn't seem beta to me.
(I guess they simply forgot to switch the 'development status' at sf :) )
But I think you don't need to switch to pmw. (At least not yet.)
I think switching to pmw isn't just dropping a couple of widgets into
your existing code. (Well, I guess you can do that, but once you use pmw,
you'll want to rewrite the whole app to be pmwish :) )
After all, the name is Python _Mega_ _Widgets_, and not 'contributed
widgets to tkinter' or something like that.
Pmw uses a framework which (imho) makes you app (or at least the gui
part) a bit more modular, but you have to get used to this framework
(with things like having a suitable __init__ method when inheriting,
with the proper incantations which make the thing work).

Its easy, but you have to read docs first, and I nobody likes to
do that :)

> Is this the way
> it is done, or is there another one that I haven't
> stumbled across yet? 
> I just need some way to select
> from a (hidden) long list.
http://effbot.org/books/tkinterbook/scrollbar.htm
describes the method of connecting a scrollbar so that is scrolls the
listbox vertically.
Adding another scrollbar is a pretty trivial extension of that pattern.

http://effbot.org/zone/tkinter-listbox.htm
might be interesting, too.

Of course  with this method, the scrollbars will be static, i.e. they
are visible even if they aren't needed because the list is too sort. If
you want dynamic scrollbars which only appear when they are needed, then
I think using the corresponding pmw widget is the easiest solution. :)

abli