-------------------------------------
toplevel .trial
frame .trial.frame1 -background lightyellow
grid rowconfigure .trial 0 \
-weight 1 \
-minsize 200
grid columnconfigure .trial 0 \
-weight 1 \
-minsize 200
grid .trial.frame1 \
-row 0 \
-column 0 \
-sticky news \
-ipadx 20 \
-ipady 20
label .trial.frame1.label1 \
-background lightblue \
-text "Bla bla bla"
grid columnconfigure .trial.frame1 0 \
-weight 1
grid rowconfigure .trial.frame1 0 \
-weight 1
grid .trial.frame1.label1 \
-row 0 \
-column 0 \
-sticky news
-------------------------------------
The result I expected was a blue label with the "Bla bla bla" text and
a 10 point wide yellow border around it (because of the -ipadx -ipady
options). What I get is just the blue box, no border...
If I use the -padx and -pady on the label then it works. The problem
with that solution is that if I have more than one label there is also
a 10 point space between labels, which I don't want.
What am I doing wrong?
TIA,
Roberto
A little confusion on what -ipadx does here, the -ipadx (or y) option does
NOT create a magic space inside a widget - it just adds the amount to the requested
size of the widget, so if the frame requests a size of 100x100 then the manager will
actually make it 140x140 (20 pixels extra on each side) - but it is still part of the frame
widget. Then when you grid the label with -sticky news - it expands to the edges of the
frame (even the "extra" pixels).
To get your desired result there are a couple of options - color the main window yellow
and use -padx 20 -pady 20 when gridding the frame, OR, create another frame as the child
of frame1 - grid/pack with -padx 20 -pady 20 & then grid all labels inside the sub-frame, OR
explicitly grid the labels in row 1 to N and then use rowconfigure on the frame to set a minsize
of 20 on rows 0 and N+1, OR the simplest way would be to not use the geometry managers for this,
but simply add -bd 20 -relief flat to the frames creation code
Bruce