[Tkinter-discuss] confused on grid positioning vs. imports

Michael Lange klappnase at web.de
Fri Mar 8 17:43:34 CET 2013


On Fri, 8 Mar 2013 10:26:10 -0600
Bryan Oakley <bryan.oakley at gmail.com> wrote:

> > I had considered this... but was concerned that it might cause some
> > confusion with widgets having similar names such as 'tk.foo()' and
> > 'ttk.foo()'.  I'll have to give it a try and see how it feels in
> > practice.
> 
> The advantage to this is that it _removes_ the confusion. With this,
> it will always be clear which foo() you're working with.

and if the similarity between 'tk.foo()' and 'ttk.foo()' still looks
confusing for you, you could simply do 

import Tkinter

instead of 

import Tkinter as tk

and you have "Tkinter.foo()" which can hardly be confused with "ttk.foo()"
(in fact I personally prefer the latter, because "import Tkinter as tk"
leaves us with a "tk" module alias that resembles too close (for my
taste) the Tkinter widget's "tk" attribute.

Regards

Michael

.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

There's nothing disgusting about it [the Companion].  It's just another
life form, that's all.  You get used to those things.
		-- McCoy, "Metamorphosis", stardate 3219.8


More information about the Tkinter-discuss mailing list