Re: How to make Tkinter Listbox entry insensitive?

2013-10-10 Thread Skip Montanaro
> It seems that this could be handled fairly straight-forwardly by
subclassing either Listbox or Frame to implement your own, custom widget.

I will freely admit that I am far from facile with Tk widgets. I've been
using GTK for most GUI apps for a long while (when I need to write such
things), but simple lists are such a PITA with GTK that I ran screaming to
Tkinter. If this small application gets much more complex, I will take a
look at subclassing Listbox.

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to make Tkinter Listbox entry insensitive?

2013-10-10 Thread Jason Swails
On Thu, Oct 10, 2013 at 2:29 PM, Skip Montanaro  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
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to make Tkinter Listbox entry insensitive?

2013-10-10 Thread Skip Montanaro
> 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. :-)

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to make Tkinter Listbox entry insensitive?

2013-10-10 Thread Chris “Kwpolska” Warrick
On Thu, Oct 10, 2013 at 4:37 PM, Skip Montanaro  wrote:
> Thanks. "disabled" did the trick. Turns out you can't disable
> individual items. Instead, you have to (hackishly) change the display
> of entries somehow to indicate their inappropriateness...

Removing inappropriate entries is not much of a hack.

-- 
Chris “Kwpolska” Warrick 
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to make Tkinter Listbox entry insensitive?

2013-10-10 Thread Skip Montanaro
> Other synonyms from GUI toolkits are "inactive" and "disabled". I
> don't know if that'll be any help though.

Thanks. "disabled" did the trick. Turns out you can't disable
individual items. Instead, you have to (hackishly) change the display
of entries somehow to indicate their inappropriateness...

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to make Tkinter Listbox entry insensitive?

2013-10-10 Thread Chris Angelico
On Fri, Oct 11, 2013 at 12:50 AM, Skip Montanaro  wrote:
> Does Tk
> perhaps use a word other than "insensitive" to describe an item which
> you'd normally be able to click?

Other synonyms from GUI toolkits are "inactive" and "disabled". I
don't know if that'll be any help though.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


How to make Tkinter Listbox entry insensitive?

2013-10-10 Thread Skip Montanaro
I have a pair of Listboxes, each with ranges of the same text.  For example:

ABCABC
DEFDEF
GHIGHI
JKLJKL

(My apologies, I'm sure Gmail is going to butcher that.)

If I select "ABC" from the first list, only the last three values in
the second list are appropriate selections. Is there a way to make a
list entry insensitive? No amount of Googling found anything. Does Tk
perhaps use a word other than "insensitive" to describe an item which
you'd normally be able to click?

Thx,

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list