0
我想打開一個文件進行讀取,詢問用戶從Tk文件打開對話框輸入,但面對一個錯誤「cannot file channel named
」 這是我的代碼。 你能讓我知道下面的代碼問題嗎?錯誤:不能在Tcl文件通道名稱
proc load_input_entries {} {
global sa sd sb sc
set types {
{{Text Files} {.txt} }
{{CSV Files} {.csv} }
{{All Files} * }
}
set fp [tk_getOpenFile -parent . \
-title "Select File" \
-filetypes $types -multiple true \
-initialdir "/simulation/safe/ip/work" ]
if {[file exists $fp]} {
set stuff [read $fp]
set lines [split $stuff "\n"]
set sa [lindex $lines 0]
set sb [lindex $lines 1]
set sc [lindex $lines 2]
set sd [lindex $lines 3]
}
}
謝謝,它現在的工作很好。 –