Tkinter's button

Cameron Laird claird at lairds.com
Wed Nov 6 16:26:05 EST 2002


In article <HX9y9.78546$aL4.2424142 at news1.tin.it>,
Alex Martelli  <aleax at aleax.it> wrote:
>black wrote:
>
>> 
>>  thanx but why we could check items by format like this: myButton["state"]
>> as I remembered that is with dictionary, while myButton is instance here
>> how could we invoke a dictionary with an instance name ? thanx in advance~
>
>Tkinter widgets are mappings (as well as being other things too).  Any
>class can define its instances to be mappings if it wants to -- the class 
>just needs to implement special methods __getitem__ etc appropriately (or 
>their equivalents for C=coded extension types).
>
>Not sure what you mean by "invoke a dictionary with an instance name".
>
>
>Alex
>

Alex, I wonder whether black is aware of the introspective keys()
method.  He might not realize that he can write
  print dict.keys()
to receive a list of the names of keys of the dict dictionary.
-- 

Cameron Laird <Cameron at Lairds.com>
Business:  http://www.Phaseit.net
Personal:  http://phaseit.net/claird/home.html



More information about the Python-list mailing list