我有以下proc會根據輸入框中當前路徑是否存在來改變選擇文件按鈕的顏色。第一,如果環路工程,第二個在執行‘$按鈕來配置-background紅’,我沒有線索,爲什麼...Tcl configure - 按鈕失效的後臺
proc ::CheckGUIPaths { } {
set FilePathList [list $::GUI_DB_path $::GUI_BDF_path $::GUI_ALLOW_path $::GUI_EXCEL_path $::GUI_HM_path]
set Buttons [list .dsm.nb.f1.btn_DBfile .dsm.nb.f1.btn_BDFfile .dsm.nb.f1.btn_ALLOWfile .dsm.nb.f1.btn_HMfile .dsm.nb.f1.btn_XLfile]
for { set n 0 } { $n <= 5 } { incr n } {
set Path [lindex $FilePathList $n]
set Button [lindex $Buttons $n]
if { [ file exists $Path ] == 1 } {
$Button configure -background green
}
if { [ file exists $Path ] == 0 } {
$Button configure -background red
}
}
return 0
}
這些是什麼樣的按鈕?他們是[按鈕](http://tcl.tk/man/tcl8.5/TkCmd/button.htm)s還是[ttk :: button](http://tcl.tk/man/tcl8.5/TkCmd) /ttk_button.htm)s? –
只是簡單的按鈕,而不是ttk :: – Lumpi