Purpose: to provide examples to the beginning Tk programmer of how the -sticky configuration parameter works on the various Tk widgets that support the flag.
For instance:
frame .addr -background orange grid .addr -sticky we entry .addr.addr1 -width 30 grid .addr.addr1 -sticky we
The original author's expectation was that the field would be left justified and would expand. - RS would rather expect it to be centered, but fill all available space. Use -justify left for left justification :)
The originator wasn't talking about text within a label or whatever being justified. They were expecting the entry box to hang on the left of frame - me, I don't know why they expected that instead of centered... I certainly expected it centered.
The -sticky argument indicates the developer is specifying on which side(s) of a grid cell a widget should appear. The parms for the -sticky are one of the following:
or some reasonable combination of these flags.
So, a value of "we" would, in my mind, mean that a widget would be centered along the horizontal axis of the grid cell. A value of "ns" would indicate that a widget would be centered along the vertical axis of the grid cell. A value of "news" would, I presume, attempt to center the widget along both axies.
CRV Why doesn't this work?
It seems to work for me. Perhaps what you mean is "why doesn't this do what I expect", but I'm not sure what it is you expect
radiobutton .rbtDs -text "Description Group" -command {} labelframe .lbfDs -labelwidget .rbtDs frame .lbfDs.fraDs -bd 2 -relief sunken label .lbfDs.fraDs.lblLDs -text "Description" label .lbfDs.fraDs.lblDs -relief sunken -justify left button .lbfDs.fraDs.btnDlDs -text "X" -command {exit} grid .lbfDs grid .lbfDs.fraDs -stick ew grid .lbfDs.fraDs.lblLDs .lbfDs.fraDs.lblDs -sticky ew grid .lbfDs.fraDs.btnDlDs
Even adding '-width 400' to either the 'labelframe' or the 'frame' will change the displayed width.
Are you aware that row and column weights affect what expands and what does not? I don't know what effect you are trying to achieve, but you might tell us if this has a positive effect (The use of rowconfigure and columnconfigure on .lbfDs.fraDs is left as an exercise to the reader):
grid .lbfDs -sticky nsew grid rowconfigure . 0 -weight 1 grid columnconfigure . 0 -weight 1
CRV I'm sorry if I was unclear. Ok, what I expect is when the frame .lbfDs.fraDs is given the parameter -sticky ew, that frame (fraDs) will expand to the left and right limits of the containing labelframe (lbfDs) -- which it clearly does not (at least not on my system). rowconfigure and columnconfigure seems not to affect the outcome. The final goal I hoped to achieve was that the empty label (lblDs) would expand to the right boundary of the containing frame (fraDs) once that frame has expanded to the boundaries of the labelframe (lbfDs). The goal is not to change any of the frame's sizes if the bounding window is resized. All this framing is a result of the necessity to isolate more controls in the same labelframe from controls located inside the frame.