Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Grid options -ipadx and -ipady not working for frames

7 views
Skip to first unread message

Roberto Hernandez

unread,
Jan 3, 2002, 4:37:20 PM1/3/02
to
I want to leave an inside padding of 10 pt inside a frame so all the
the widgets aren't too close to the border. So I tried the -ipadx and
-ipady options when mapping the frame, but for some reason that
doesn't work. Here's the code:

-------------------------------------
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

Bruce Hartweg

unread,
Jan 4, 2002, 5:56:47 AM1/4/02
to

"Roberto Hernandez" <rob...@adinet.com.uy> wrote in message news:fd8bdbb8.02010...@posting.google.com...

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

0 new messages