[Tutor] Tkinter

David Rock david at graniteweb.com
Thu Apr 29 16:07:10 EDT 2004


* olavi at city.ee <olavi at city.ee> [2004-04-29 19:44]:
> Hi everybody!
> 
> Can anybody tell, what is the difference between
> 
>     label = Label(root, text="Label1").grid()
> 
> and
> 
>     label = Label(root, text="Label1")
>     label.grid()
> 
> Which method is better to use?

label = Label(root, text="Label1").grid()

assigns the grid object to the variable label, while 

label = Label(root, text="Label1")

assigns the LABEL object to label. The second one is probably better
because you are working with the primary object that you can call ALL
methods for, not just grid(), while the first is limited to JUST grid()

-- 
David Rock
david at graniteweb.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20040429/4a859c43/attachment.bin


More information about the Tutor mailing list