Re: A few Tk related queries
From: Bruce Hartweg (bruce-news_at_hartweg.us)
Date: Fri, 28 Nov 2003 03:02:40 GMT
Arpan Sen wrote:
> Aric Bills wrote:
> Hello Aric,
> Thanks a ton for the excellent explanations. But I have a couple of questions
> on what you
> have written. Here they are :
> 1. when i use pack geomtery manager, i have to use -fill x so that things get
> readjusted when
> stretched or shrinked, but my questions is when i pack a menubutton on it
> with side option as
> left what has it got to do with side fill?
because the menubutton *is* on the left, the left of the frame. but the
frame is in the center of the window. so either make the frame fill the
window horizontally (-fill x) or also anchor it to the left side.
one way to help understand geometry stuff is to just play around with
the various options & make each of your windows, frames & other widgets
all have different background colors so you can see how they are working
> 2. if i use .top.file.menu add <...> things do not work for me though they
> should and i don't know
> why. i just mentioned the hack i used to bypass it.
please copy/paste the chunk of code you have exactly, as well as the
actual error message (if there is one) or describe the behavior that
> I would like to know more about the grid geomtery manager. How does it overcome
> such cases?
it can simplify a great many things for layouts, when using pack to layout
a medium complex gui you can end up with a lot of intervening frames just
to make the layout right. you end up with a .top, .middle ..bottom and
then .top.left .top.right, .top.left.w1 ... etc.
with grid you can just create all of the individual widgets actually needed
and hen lay them out on a virtual grid - each widget can span multiple
"cells" in either direction, they can float within the boundaries of the
occupied cells (or stick to any/all the edges, you can assign weights
for each column and row to allocate extra space during resize. and the
shortcut notation for gridding can be an ascii picture of your gui right
in your code.
Hope this helps,