LoginSignup
2

More than 5 years have passed since last update.

Tcl/Tkでステータスバーを作る

Posted at

Tcl/Tkでステータスバーもどきを作ろうとすると、なかなか文字列を上手く左右に配置できません。左寄せで出す文字列と右寄せで出す文字列の間にダミーの文字列を入れる事で、フレームの両端に文字を表示できます。

画像

frame.tcl
frame .f
label .f.left -text "左寄せ"
label .f.space -text " "
label .f.right -text "右寄せ"
pack .f.left  -side left -anchor w 
pack .f.space -side left -expand yes -fill x ; #真ん中だけを -expand yes に設定する。
pack .f.right -side left -anchor e 
pack .f -anchor w -fill x  ;# -fill でx方向へ引き延ばす

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2