Widgetのレイアウト

Widgetをレイアウトするには、以下の3つの方法があります。
それぞれに一長一短があるので、用途に合ったものを使いましょう。
Geometryマネージャの種類と特徴
place方式

Widgetを座標でレイアウトします。古いレイアウト方法です。
奇麗なレイアウトができるのは○、
文字列の伸長に弱く国際化に不向きなのは×
pack方式 Widgetを方位でレイアウトします。一般的なレイアウト方式です。
文字列の伸長に強く国際化に向いているのは○、
frame widgetを多用しなければならないのは×
grid方式 Widgetを格子状にレイアウトします。新しいレイアウト方式です。
比較的楽にイメージ通りになるのは○、
コード量が多くなる傾向があるのは×。
SpecTcl(GUIビルダ)は、grid方式のコードを生成します。

place方式

ウィンドウのリサイズには対応できません。

text .t -yscroll {.sv set} -xscroll {.sh set} -wrap none
place .t -x 0 -y 0 -width 100 -height 100
scrollbar .sv -command {.t yview}
place .sv -x 100 -y 0 -height 100
scrollbar .sh -orient horizontal -command {.t xview}
place .sh -x 0 -y 100 -width 110
. configure -width 115 -height 115

pack方式

ウィンドウのリサイズに対応できます。
リサイズするとtextがそれに合わせて追従します。
右下の処理がいまいちです。

pack [frame .f] -fill both -expand 1
text .t  -width 15 -height 7 -yscroll {.sv set} -xscroll {.sh set} -wrap none
pack .t -side left -fill both -expand 1 -in .f
scrollbar .sv -command {.t yview}
pack .sv -side right -fill y -in .f
scrollbar .sh -orient horizontal -command {.t xview}
pack .sh -side top -fill x

grid方式

ウィンドウのリサイズに対応できます。
リサイズするとtextがそれに合わせて追従します。

text .t  -width 15 -height 7 -yscroll {.sv set} -xscroll {.sh set} -wrap none
scrollbar .sv -command {.t yview}
scrollbar .sh -orient horizontal -command {.t xview}
grid .t -in . -row 0 -column 0 -sticky nsew
grid .sv -in . -row 0 -column 1 -sticky ns
grid .sh -sticky we
grid columnconfigure . 0 -weight 1
grid rowconfigure . 0 -weight 1