Tkinter: Why aren't my widgets expanding when I resize the window?

John Salerno johnjsal at gmail.com
Mon Mar 5 23:07:05 CET 2012


> > I don't like importing things piecemeal. I suppose I could do:
> 
> So you prefer to pollute? How bout we just auto import the whole
> Python stdlib so you can save a few keystrokes?

> > so that's four more constants I'd have to explicitly import. And
> > (tk.N, tk.S, tk.E, tk.W) is just horrible to look at.
> 
> Wah!
> 
> Stop whining and act like a professional! You complain about
> qualifying constants but you happily type "self" until your fingers
> bleed without even a whimper???
> 
> Look, either import ONLY the constants you need, or qualify each
> constant with a module name/variable; that is the choices available to
> a professional. Or, just be lazy and pollute your namespace.
> 
> FYI: Lazy coders get what they deserve in the end.

How exactly am I being lazy and polluting the namespace? I never said I wanted to use the "*" import method, if that's what you are (wrongly) assuming. I said it seems cleaner and, to me, LESS lazy to import the whole module as "import tkinter.constants as tkc" and qualify everything. It's certainly more explicit than importing constants on an as-needed basis, having an ever-increasing list of constants, and referring to them unqualified in the code.

Yes, I complain that tk.N, tk.S, etc. is ugly to look at, but I'm saying it seems like a better way than using them unqualified, unless maybe there is yet another, better way.

As far as using "self" all the time, how do you know I never "whimpered" about it? The first time I learned about it I DIDN'T like it, because it seemed like a lot of unnecessary typing, but eventually I came to accept it because 1) you HAVE to do it, unlike the various options for referring to these constants, and 2) I began to like the explicitness of qualifying everything with "self."

You are very helpful, but you sure like to throw around the term "lazy" a little too unabashedly. I never said I wanted to import with "*", which you seem to think I want to do. I LIKE qualifying things, which is the reason I didn't care so much for your method of importing the constants by name.



More information about the Python-list mailing list