Sunday, December 22, 2013

tcl: dumping tablelist data

For the tablelist widget I created a function to dump the table content to a file

proc dumpTableListToFile { tree { file preview.txt } } { 
set rowCount [$tree size]
set file_writer [open $file w+]
for { set i 0 } { $i < $rowCount } { incr i } {
set rowData [$tree get $i]
puts $file_writer $rowData
}
close $file_writer
}


parameters:



tree, is the table widget, file is the file name, optional.