[Tutor] Dynamically changing the state of a button

Suzanne Little s349929@student.uq.edu.au
Wed, 12 Jan 2000 13:04:29 +1000 (GMT+1000)


I decided to put this in a separate post since it really is two separate
problems. For details on the general project and some sample code please
see my previous post (How do I update a listbox?). I need to change the
state option of buttons from disabled to normal depending upon whether an
item is selected in a listbox. The things I've tried have been to bind an
event to clicking the mouse in the listbox which causes a test of whether
an item is selected and if so calls a function to remake the button frame
and change the states. It does this by first destroying the button frame
and then calling the make function and passing a value  
(normal/disabled). Obviously this is really messy and it doesn't work. The
bind/event doesn't notice that an item has been selected until the second
time you click and destroying/recreating the button frame looks 
awful. I've been reading around on python.org and my best guess is that I
might need to do something with after_idle() and update() but I don't
understand how either of these work. I need to extend this a bit as well
(one button should only be enabled if a certain type of element is

If you're still with me after that rather confusing explanation, any
suggestions would be greatly appreciated.



"Contrariwise," continued Tweedledee, "If it was so, it might be; and if
it were so, it would be; but as it isn't, it ain't.  That's logic"
                             -Lewis Carroll