#!/usr/bin/wish # 實驗各種 option 的效果. 此處以 -justify 與 -anchor 為例. # 當你遇到其他有疑問的 options 時, 不妨多多利用這個程式 (加以修改) 來實驗. # initialization script: 畫面左半是 .show, 右半是 .ctrl frame .show label .show.watchme -width 30 -height 12 -bd 2 \ -relief groove -text "Effect\nOf justify\nAnd anchor" label .show.costr pack .show.watchme .show.costr -side top -fill both frame .ctrl button .ctrl.action -text "Change It!" -command change_it frame .ctrl.just radiobutton .ctrl.just.left radiobutton .ctrl.just.center radiobutton .ctrl.just.right set v_just center foreach item {left center right} { .ctrl.just.$item configure -variable v_just \ -value $item -text $item } pack .ctrl.just.left .ctrl.just.center .ctrl.just.right \ -side left -fill both listbox .ctrl.anchor .ctrl.anchor insert 0 nw n ne w center e sw s se .ctrl.anchor selection set 4 pack .ctrl.action .ctrl.just .ctrl.anchor -side top -fill both pack .show .ctrl -side left -fill both proc change_it {} { global v_just set anchor [.ctrl.anchor get [.ctrl.anchor curselection]] .show.costr configure -text "-justify $v_just -anchor $anchor" .show.watchme configure -justify $v_just -anchor $anchor }