[Tutor] Showing/hiding widgets in Tkinter

The Green Tea Leaf thegreentealeaf at gmail.com
Thu Apr 7 12:44:27 CEST 2011


On Wed, Apr 6, 2011 at 15:35, Peter Otten <__peter__ at web.de> wrote:
>> Unfortunately, it doesn't work. I can see the label flashing when I
>> press the button but it's not visible unless I press the button again.
>
> I don't understand that sentence. If you press the button the label should
> disappear. When you press it again it should become visible again.

What happened yesterday was (assuming initial state when the label was visible)

+ I clicked the button
+ The label disappeared
+ I clicked the button again
+ Noting became visible
+ I clicked the button
+ Nothing became visible

Then, getting a bit frustrated, I started to repeatedly click the
button and discovered that I could actually see the label when I the
button pressed (that is, I was holding down the mouse button) but not
when it was released.

> That does what it's expected to do over here.

This works just fine today ... (sigh, I hate when things work one day
but not an other day)

------------------

I suddenly thought about one thing that I tested and my guess is that
the window needs to refresh to show the label that was hidden. I
comment out the line

btnToggle["text"] = "Hide Example"

then I get the same behavior as yesterday.
-- 
The Green Tea Leaf   thegreentealeaf at gmail.com   thegreentealeaf.blogspot.com


More information about the Tutor mailing list