Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #56609

Re: How to make Tkinter Listbox entry insensitive?

References <CANc-5UxAau6djZ+zYQ+8a=3nPGHx_aDEUUtCVAcwOtq2fz4ZHw@mail.gmail.com> <CAPTjJmpmaa8JWE7VRA49tZKKrdkPSfGDVGOC9108ZobBeHJmMQ@mail.gmail.com> <CANc-5UyuKi-cAzCR6b2p81JggR557xjRTSwmG4xRmCBX9cbNYQ@mail.gmail.com> <CAMw+j7+pfnkjfj+vCUuCXLWnJHaA8n4n3Vrb5b+depXOjaMwAQ@mail.gmail.com> <CANc-5Ux6V4u-JUz0M4ntOPSXm+t3yEB_dOmOL50NZbGeXr=DDg@mail.gmail.com>
Date 2013-10-10 17:44 -0400
Subject Re: How to make Tkinter Listbox entry insensitive?
From Jason Swails <jason.swails@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.961.1381441480.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Thu, Oct 10, 2013 at 2:29 PM, Skip Montanaro <skip@pobox.com> wrote:

> > Removing inappropriate entries is not much of a hack.
>
> True, but then I have to go through the trouble of adding them back in
> should they become valid again. :-)
>

It seems that this could be handled fairly straight-forwardly by
subclassing either Listbox or Frame to implement your own, custom widget.
 The trick is to retain references to every entry within the widget, but
only embed it in the viewable area if it happens to be a valid entry at
that point.  Then all that's left is to hook events up to the proper
callbacks that implement various actions of your custom widgets using what
Tkinter is capable of doing.

Personally I prefer to subclass Frame since it allows me the maximum
flexibility (I think 90+% of the widgets I've written for my own
Tkinter-based programs do this).

All the best,
Jason

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: How to make Tkinter Listbox entry insensitive? Jason Swails <jason.swails@gmail.com> - 2013-10-10 17:44 -0400

csiph-web