Tkinter Query - Solved it

Chad Netzer cnetzer at mail.arc.nasa.gov
Sat Oct 12 00:17:15 CEST 2002


On Friday 11 October 2002 15:02, Newt wrote:
> > Post that code...  Let's take a look.
>
> Solved it !!! I've included the source (as Chaz requested) below.

   Chad, not Chaz. :)

> Up until now, I've used the following line to create sval:
>     sval = Label(wskill, text = "10").grid=(row=pos+2,col=2)

Aha!  Sorry I missed this.  This assigns the return value of grid() to sval, 
rather than the Label object (as you discovered).  So if you didn't care to 
keep your own reference to the label (say you never intend to change it), 
then something like this works:

Label(wskill, text = "10").grid=(row=pos+2,col=2)

   But if want to refer to the Label later, you (usually) need to reference 
it, before you start using it:

sval = Label(wskill, text = "10")
sval.grid=(row=pos+2,col=2)

I learned that the hard way as well, in the early days. :)

-- 

Chad Netzer
cnetzer at mail.arc.nasa.gov




More information about the Python-list mailing list