#!/usr/bin/wish # 實驗各種 option 的效果. 此處以 -bg, -text, 與 -bd 為例. # 當你遇到其他有疑問的 options 時, 不妨多多利用這個程式 (加以修改) 來實驗. scale .bd -orient horizontal -from 0 -to 50 -length 200 -command change_bd label .watchme -relief ridge -text "" button .bg -text -bg -command change_bg button .text -text -text -command change_text pack .bd -side bottom -fill both pack .watchme -side left -fill both pack .bg .text -side top -fill both . configure -bg yellow # ================================================================= proc change_bd {bd} { .watchme configure -bd $bd } proc change_bg {} { set color [.watchme cget -bg] set color [tk_chooseColor -initialcolor $color] if {$color == ""} then return .watchme configure -bg $color } proc change_text {} { set fn [tk_getOpenFile] if {$fn == ""} then return .watchme configure -text $fn }