Bryan Oakley <bryan.oakley <at> gmail.com> writes: > My advice: > > Always do it this way: > > import Tkinter as tk > import ttk > > There! Now there's no global namespace pollution, and everything's > accessible. Plus, it becomes immediately clear whether you're using > ttk widgets or tkinter widgets: ttk..Button(...) or tk.Button(...). > Your code becomes more self documenting. Also, if you switch to > python3 you have to change just the imports and everything should > continue to work.
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. > > As for the constants, with this scheme you would use tk.BOTH, etc. > Personally I'm in favor of never using the constants; I see no value > in them. These things truly are constants in the underlying tk > plumbing, so you can just use the literal string "both', "n", etc > rather than the constants. There's simply no need to use a constant > named BOTH when you can use "both". Plus, isn't "nsew" better than > N+S+E+W? > I'm a little fuzzy here on exactly what you mean by 'constants'... I thought 'both', S+E, etc. were parameters for a function call, not constants... _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss