[Tkinter-discuss] importing tk.W?
Alan Gauld
alan.gauld at btinternet.com
Sun Apr 20 19:28:09 CEST 2014
On 11/03/14 03:27, memilanuk wrote:
> appears I can use either a wildcard import, enclose it in quotes, or use
> explicit reference e.g. tk.W.
>
> My question is this: How / why does this make any sense, that an
> attribute (W) to an option (sticky=) would be imported at the same level
> as widgets themselves? Is it some artifact left over from tcl,
In a way it is a Tcl thing. The earliest Tcl including the original Tk
did everything with strings using implicit conversion as needed. So in
Tcl W and 'W' were treated as the same thing, no need for a constant.
When Tkinter was invented Python needed constants or strings so Tkinter
provided for both.
Personally, I generally use the strings for options.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos
More information about the Tkinter-discuss
mailing list