<p><a href="http://en.wikipedia.org/wiki/Tcl" rel="noreferrer">Tcl/Tk</a> is a simple way to script small GUIs.</p>

<p>Can anyone give a nice example with a <em>button</em> and a <em>text</em> widget. When the button is pressed should a shell command be executed and the output piped to the <em>text</em> widget.</p>

<p>If you have other nice and clean examples for useful tasks, please add them too.</p>

I can give a start...please suggest improvements. I.e I'd like it to scroll as the command is outputting
```
```
#!/usr/bin/wish

proc push_button {} {
    put_text
    .main see end
}

proc put_text {} {
  set f [ open "| date" r]
  while {[gets $f x] >= 0} {
    .main insert end "$x\n"    
  }
  catch {close $f}
}

button .but -text "Push Me" -command "push_button"
text .main -relief sunken -bd 2 -yscrollcommand ".scroll set"
scrollbar .scroll -command ".main yview"

pack .but
pack .main -side left -fill y
pack .scroll -side right -fill y
```
```