From: Guest <fakeemail100 / earthlink.net> Subject: TK packing Date: Wed, 8 Mar 2006 12:20:00 +0900 Message-ID: <459a6f8c437c10bf32b82e2157aa7553 / ruby-forum.com> > How can I pack this so it looks like this. > > [New Sprite [-][+][x]] > ------------------------- > | Width: [ ] | > | Height: [ ] | > - - - - - - - - - - - - Please read a Tcl/Tk's document about the rule of 'pack' geometry manager or 'grid' geometry manager. > dialogBox = TkToplevel.new('title'=>'New Sprite') > frame = TkFrame.new(dialogBox).pack('fill'=>'both') > > widthLabel = TkLabel.new(frame, 'text'=>'Width: ') > widthEntry = TkEntry.new(frame) > widthEntry.value = 32 > heightLabel = TkLabel.new(frame, 'text'=>'Height: ') > heightEntry = TkEntry.new(frame) > heightEntry.value = 32 --------< example 1 >--------------------------------------- dialogBox = TkToplevel.new(:title=>'New Sprite') frame = TkFrame.new(dialogBox).pack(:fill=>'both') f_width = TkFrame.new(frame).pack widthLabel = TkLabel.new(f_width, :text=>'Width: ').pack(:side=>:left) widthEntry = TkEntry.new(f_width).pack(:side=>:left) widthEntry.value = 32 f_height = TkFrame.new(frame).pack heightLabel = TkLabel.new(f_height, :text=>'Height: ').pack(:side=>:left) heightEntry = TkEntry.new(f_height).pack(:side=>:left) heightEntry.value = 32 ------------------------------------------------------------ --------< example 2 >--------------------------------------- dialogBox = TkToplevel.new(:title=>'New Sprite') frame = TkFrame.new(dialogBox).pack(:fill=>'both') widthLabel = TkLabel.new(frame, :text=>'Width: ') widthEntry = TkEntry.new(frame) widthEntry.value = 32 Tk.grid(widthLabel, widthEntry) heightLabel = TkLabel.new(frame, :text=>'Height: ') heightEntry = TkEntry.new(frame) heightEntry.value = 32 Tk.grid(heightLabel, heightEntry) ------------------------------------------------------------ -- Hidetoshi NAGAI (nagai / ai.kyutech.ac.jp)