[Tutor] Tkinter stuff

alan.gauld@bt.com alan.gauld@bt.com
Fri, 7 Dec 2001 17:26:24 -0000


I missed this original post and the digest screwed up so 
I can't reply to it...

> JM Wrote:
>    Of course I'm a beginner, but when I see something like :
>
> Label(fen1, text = 'Premier champ :').grid(sticky =E)
> Label(fen1, text = 'Second :').grid(sticky =E)
> Label(fen1, text = 'Troisi=E8me :').grid(sticky =E)

This is OK and pretty standard style Tkinter since you rarely 
need to change Labels once created but...

> entr1 =3D Entry(fen1).grid(row =0, column =1)
> entr2 =3D Entry(fen1).grid(row =1, column =1)
> entr3 =3D Entry(fen1).grid(row =2, column =1)

This won't work because it assigns the value returned by 
grid() to the variables. grid() returns None!

The only way to get a handle on the widget, which I assume 
the original auther was trying to do, is to create the widget 
then grid or pack it. Like so:

entr3 = Entry(fen1)
entr3.grid(row =2, col = 1)

More long winded but has the advantage of actually working.

Alan g.
Author of the 'Learning to Program' web site
http://www.freenetpages.co.uk/hp/alan.gauld/