From: Mathieu Bouchard Date: 2001-12-05T08:10:56+09:00 Subject: [ruby-talk:27490] Re: Ruby/Tk 'pack' question On Wed, 5 Dec 2001, Hal E. Fulton wrote: > Trying to figure out how to do this *without* > using nested frames. > What I want: A window with (conceptually) > "three rows": > 1. label + entry field > 2. label + entry field > 3. three buttons > Now, I'm trying to figure out what combination > of side/anchor/fill/expand (for these seven > pack operations) will give me this. That's because you don't understand what the pack() layout-manager allows. it allows two columns of widgets on top of each other, one from the top to the middle and one from the bottom to the middle, and a row of widgets on each side of that, from outer to inner. Therefore, you can only do this using 4 packs, or 1 grid, or 1 grid and 1 pack, depending on your aesthetics. Here's an example using 1 grid and 1 pack. require 'tk' root=TkRoot.new 2.times {|y| TkLabel.new(root) {text "hello"}.grid "column"=>0,"row"=>y } 2.times {|y| TkEntry.new(root) {width 20 }.grid "column"=>1,"row"=>y } TkFrame.new(root) { 3.times {|x| TkButton.new(self) {text x}.pack "side"=>"left" } }.grid "column"=>0, "row"=>2, "columnspan"=>2 Tk.mainloop ________________________________________________________________ Mathieu Bouchard http://hostname.2y.net/~matju