source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/vrippack-0.31/lib/linux/tk8.4/demos/timer

Last change on this file was 37, checked in by (none), 14 years ago

Added original make3d

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#!/bin/sh
2# the next line restarts using wish \
3exec wish8.4 "$0" "$@"
4
5# timer --
6# This script generates a counter with start and stop buttons.
7#
8# RCS: @(#) $Id: timer,v 1.3 2001/10/29 16:23:33 dkf Exp $
9
10label .counter -text 0.00 -relief raised -width 10 -padx 2m -pady 1m
11button .start -text Start -command {
12    if {$stopped} {
13        set stopped 0
14        set startMoment [clock clicks -milliseconds]
15        tick
16        .stop configure -state normal
17        .start configure -state disabled
18    }
19}
20button .stop -text Stop -state disabled -command {
21    set stopped 1
22    .stop configure -state disabled
23    .start configure -state normal
24}
25pack .counter -side bottom -fill both
26pack .start -side left -fill both -expand yes
27pack .stop -side right -fill both -expand yes
28
29set startMoment {}
30
31set stopped 1
32
33proc tick {} {
34    global startMoment stopped
35    if {$stopped} {return}
36    after 50 tick
37    set elapsedMS [expr {[clock clicks -milliseconds] - $startMoment}]
38    .counter config -text [format "%.2f" [expr {double($elapsedMS)/1000}]]
39}
40
41bind . <Control-c> {destroy .}
42bind . <Control-q> {destroy .}
43focus .
44
45# Local Variables:
46# mode: tcl
47# End:
Note: See TracBrowser for help on using the repository browser.