TK packing


#1

How can I pack this so it looks like this.

[New Sprite [-][+][x]]

| Width: [ ] |
| Height: [ ] |


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


#2

From: Guest removed_email_address@domain.invalid
Subject: TK packing
Date: Wed, 8 Mar 2006 12:20:00 +0900
Message-ID: removed_email_address@domain.invalid

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)