if 0 {[Richard Suchenwirth] 2003-02-28 - In a [wish] on the [iPAQ], a plain [puts] raises the error cannot find channel named "stdout" But as [puts] is a frequent and useful command, we want to have it working. So here�s a substitute that redirects the output to a specified text widget: } proc redef_puts w { set ::putsw $w if ![llength [info command ::tcl::puts]] { rename puts ::tcl::puts proc puts args { set la [llength $args] if {$la<1 || $la>3} { error "usage: puts ?-nonewline? ?channel? string" } set nl \n if {[lindex $args 0]=="-nonewline"} { set nl "" set args [lrange $args 1 end] } if {[llength $args]==1} { set args [list stdout $args] } foreach {channel s} $args break if {$channel=="stdout" || $channel=="stderr"} { $::putsw insert end $s$nl } else { set cmd ::tcl::puts if {$nl==""} {lappend cmd -nonewline} lappend cmd $channel $s eval $cmd } } } } ---- [Arts and Crafts of Tcl-Tk Programming]