Ruby/Tk: Problem with left-justifying widgets

R

Ronny

Problem: My window should consists of several lines. Each line consists
of
- a checkbox
- a label
- an entry field

I used the following approach (which works basically well - but see
below):

# Code for adding one line to the root window:
frame=TkFrame.new(root)
frame.pack()
check=TkCheckButton.new(frame).pack("side" => "left")
label=TkLabel.new(frame) { text "...." }
label.pack("side" => "left")
entry=TkEntry.new(frame).pack("side" => "left")
entry.value="...."

Now the problem is that since the label texts and initial values for
each line are of
different size, and since by default the frame is centered within the
root window,
the check buttons turn out to be not lined up one below the other,
which gives an ugly look.

I tried to remedy this by changing the first statement to

frame=TkFrame.new(root) { justify 'left' }

but this does not work, because "justify" is not valid for a TkFrame.

Any idea how to solve this? Since it is so common to have lined up
checkboxes
one below the other, I guess there must be an easy solution to this,
but I don't
see how...

Ronald

PS: As always, other types of critics to my code, as well as hints of
where on the I could
have found the information I'm looking for, are welcome.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top