2 # the next line restarts using wish \
6 # This script generates a counter with start and stop buttons.
8 # RCS: @(#) $Id: timer,v 1.2 1998/09/14 18:23:30 stanton Exp $
10 label .counter -text 0.00 -relief raised -width 10
11 button .start -text Start -command {
17 button .stop -text Stop -command {set stopped 1}
18 pack .counter -side bottom -fill both
19 pack .start -side left -fill both -expand yes
20 pack .stop -side right -fill both -expand yes
27 global seconds hundredths stopped
30 set hundredths [expr $hundredths+5]
31 if {$hundredths >= 100} {
33 set seconds [expr $seconds+1]
35 .counter config -text [format "%d.%02d" $seconds $hundredths]
38 bind . <Control-c> {destroy .}
39 bind . <Control-q> {destroy .}