[Tutor] The case of the scrolling label....

andy surany mongo57a@comcast.net
Sat Dec 7 07:37:02 2002


Makes sense. And I think that you have cautioned me about it once
before. Thanks for the reminder.

-----Original Message-----
From: Magnus Lycka <magnus@thinkware.se>
To: andy surany <mongo57a@comcast.net>; tutor@python.org
<tutor@python.org>
Date: Saturday, December 07, 2002 3:49 AM
Subject: Re: [Tutor] The case of the scrolling label....


>At 23:53 2002-12-06 -0500, andy surany wrote:
>>I am putting up a label when an improper entry is received.
>>
>>Label(text='Invalid Entry').pack() # Tk
>>
>>Works fine. But how do I get rid of it?
>
>Don't throw away the reference to it!
>
>It irritates me (I've written about this before) that a lot
>of GUI code relies on magic hand-hold that let people use
>object instanciations as if they were some kind of procedure
>calls. It gives the wrong idea.
>
>I would do
>   attention = Label(text='')
>   attention.pack() # Can't do these in one line (think about it)
>as a part of program init, and then
>   attention['text'] = 'Invalid Entry'
>when things go wrong, and
>   attention['text'] = ''
>when I don't want to show that any longer.
>
>The variable must persist to be useful. If you're in a class,
>use "self.attention = Label(text='Invalid Entry')" and so on.
>
>Another option could be to do
>   attention = Label(text='Invalid Entry')
>   attention.pack()
>when needed, and
>   attention.destroy()
>when you want the text to go away.
>
>I would NOT use that. How on earth are you going to have any
>control over your UI when you realize that you have to add more
>things in your frame. I'd layout my windows in the beginning,
>and then fill in values as appropriate.
>
>
>
>--
>Magnus Lycka, Thinkware AB
>Alvans vag 99, SE-907 50 UMEA, SWEDEN
>phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
>http://www.thinkware.se/  mailto:magnus@thinkware.se
>
>
>_______________________________________________
>Tutor maillist  -  Tutor@python.org
>http://mail.python.org/mailman/listinfo/tutor