#!/usr/local/bin/wish -f frame .topbuttons -borderwidth 10 pack .topbuttons -side top -fill both # Three buttons and an entry field button .topbuttons.quit -text Quit -command exit button .topbuttons.cat -text Cat -command Cat entry .topbuttons.e1 -width 40 -relief sunken pack .topbuttons.quit -side right pack .topbuttons.cat -side right pack .topbuttons.e1 -fill x -expand yes # Text area with a scrollbar text .log -xscrollcommand ".xscroll set" -yscrollcommand ".yscroll set" \ -width 50 -height 20 -bd 2 -relief raised -wrap none scrollbar .yscroll -command ".log yview" scrollbar .xscroll -command ".log xview" -orient horiz pack .yscroll -side right -fill y pack .xscroll -side bottom -fill x pack .log -side top -expand yes -fill both # The cat procedure. The delete line says to delete all characters in # .log from line 1, char 0 to the end. proc Cat {} { set filename [.topbuttons.e1 get] catch {exec cat $filename} results .log delete 1.0 end .log insert end $results }