W W wrote:
On Sat, Mar 28, 2009 at 9:47 AM, Wayne
Watson <sierra_mtnv...@sbcglobal.net>
wrote:
Hi, that's an interesting way
to look at it. Actually, I was about to
probe the color idea myself, but needed to better understand how to
achieve it. Where did grid_columnconfigure(3, weight=1) come from? I
don't recall seeing that with Frame. Grid has columnconfigure. I
started down that path once, but got waved off. Interesting about
master.
It's not part of frame, it's actually part of the grid manager, but you
have to call it on the parent widget, and as such it won't get screwy
when combined with a parent that has the .pack method called on it.
I'm looking at the NM Tech Tkinter ref, pages 5-6, on the grid method.
See pages 84-88 of Lundh. Nothing. It does not show that method. Search
of the pdf doc shows nothing. Are these sources too old? effbot does
have it. Yes, it's pretty decent. I've used it before. It looks like it
may be the newest, 2005, of the three, although NM Tech seems to get
updated pretty often. 5/2007, but I think there was a recent update.
Maybe they don't want the students to use it.
What I've discovered is that I did not really understand the role of
sticky, and the bounds of the label. I thought sticky=W meant put the
blasted label to the left margin. What sticky means, according to
Grayson's chapter 5 on the web, is that it allows the widget to stretch
when the larger window is resized. Knowing the boundaries with color
coding can help understand that, and other oddities. Label seems to
always center the text. Changing the label's width and height achieves
interesting insights. I tried anchor with Label and it does interesting
things. The length of the text messes with matters.
It didn't move the text in the label at all. There's got to be some
padding on either end I'm missing. Interestingly, I had set the width
of the label to 12, and the color version showed gray to the left and
right of the text, with the text in the center. I removed width, and
the left-right spaces disappeared, but the text was still centered.
Well, OK, the selected width, which matches the length of the text,
really doesn't allow for justification. Foiled again. It seems like the
width for the frame container for the latitude+BOX needs to be
specified to give latitude some ability to go left. A column for
latitude and one for BOX? Beats me. Back to exploration after I finish
this response.
To put some focus on what I think is the real problem, try this. See if
the text in labels lines up on the left if a column of Labels is create
with these labels.
vinegar
pie
latitude for x
Snowy
I haven't tried it yet, but would expect to get something like:
vinegar
pie
latitude for x
Snowy
anchor with Label may move them to the left.
In my case, I'm looking for stuff like:
Latitude BOX Longitude BOX
x BOX y BOX
and not
Latitude BOX Longitude BOX
x BOX y BOX
Grid is a useful manager for this type of scenario. Grid is very
similar to the old HTML table. If you want to align it that way with
grid, you could easily do something that looks like this:
Unless these boxed lines indicate something like a frame, I think we
are talking about exactly the same thing. BTW, there are ASCI draw
tools available, but I've never used them. Yes, drawing it on paper is
fine, but it hasn't helped me solve the alignment problem.
+------------+-------+--------------+--------+
| Latitude | Box | Longitude | Box |
+-+------+--+-------+--------------+--------+
| x | BOX| y | BOX | |
+-+------+--+-------+------------------------+
Forgive the poor ascii art, but with some simple configurations like
columnspan, you can set it up to fit whatever you want (it usually
helps to draw out your design on paper).
I want the text in the left column aligned. It doesn't really matter
about the alignment of Longitude with y. One would think this would be
a snap. I'm quite surprised no one seems to have considered an example
along these lines. I guess everyone is center happy.
Using the grid manager and justify=LEFT you shouldn't have much of a
problem
See earlier comment.
I have yet to find a good source that explains Grid in a thorough way.
Lots of piecemeal things. Many too brief. Perhaps the best thing I've
found is Grayson's chapter 5 image editor, p86f. He has a very complex
looking grid of buttons, combo boxes and images, but it all makes sense
as to the layout. It took me awhile to see why he needed so many rows
and columns for those 9 (actually 10) thumbnails. It's all about what
goes on in the lower right corner. Unfortunately, he had no need to
align the text to the left uniformly in a column.
If you want to have the text align you have a few options - you can
have several labels in the same grid row/column, or you can line them
up with their own cells.
HTH,
Wayne
--
Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
(121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)
“Life is one damn thing after another."
-- Mark Twain
|