OUTPUT BUFFER:
#!/usr/local/ActiveTcl/bin/wish proc clockSet var { global $var set $var [clock format [clock seconds] -format %H-%M-%S] after 900 [list clockSet $var] } proc setLCD {} { # The shapes of individual elements of a digit global lcdshape global lcdelems array set lcdshape { a {3.0 5 5.2 3 7.0 5 6.0 15 3.8 17 2.0 15} b {6.3 2 8.5 0 18.5 0 20.3 2 18.1 4 8.1 4} c {19.0 5 21.2 3 23.0 5 22.0 15 19.8 17 18.0 15} d {17.4 21 19.6 19 21.4 21 20.4 31 18.2 33 16.4 31} e {3.1 34 5.3 32 15.3 32 17.1 34 14.9 36 4.9 36} f {1.4 21 3.6 19 5.4 21 4.4 31 2.2 33 0.4 31} g {4.7 18 6.9 16 16.9 16 18.7 18 16.5 20 6.5 20} } # Which elements are turned on/off for a given digit? foreach {digit onElems offElems} { 0 {a b c d e f} {g} 1 {c d} {a b e f g} 2 {b c e f g} {a d} 3 {b c d e g} {a f} 4 {a c d g} {b e f} 5 {a b d e g} {c f} 6 {a b d e f g} {c} 7 {b c d} {a e f g} 8 {a b c d e f g} {} 9 {a b c d e g} {f} - {g} {a b c d e f} { } {} {a b c d e f g} } { set lcdelems(on-$digit) $onElems set lcdelems(off-$digit) $offElems } } # Displays a decimal number using LCD digits in the top-left of the canvas proc showLCD {w num {width 5} {colours {#ff8080 #ff0000 #404040 #303030}}} { global lcdshape global lcdelems set lcdoffset 0 $w delete lcd foreach {onRim onFill offRim offFill} $colours {break} foreach {H M S} [split $num "-"] {} foreach e {H M S} { foreach glyph [split [set $e] {}] { foreach symbol $lcdelems(on-$glyph) { $w move [eval $w create polygon $lcdshape($symbol) \ -tags lcd \ -outline $onRim -fill $onFill] $lcdoffset 0 } foreach symbol $lcdelems(off-$glyph) { $w move [eval $w create polygon $lcdshape($symbol) \ -tags lcd \ -outline $offRim -fill $offFill] $lcdoffset 0 } incr lcdoffset 22 } incr lcdoffset 22 } } proc LaTrace {args} { global maclock showLCD .c $maclock } canvas .c -bg "#303030" pack .c setLCD clockSet maclock showLCD .c $maclock foreach {- - wd hg} [.c bbox all] break .c configure -width $wd -height $hg trace add variable maclock write LaTrace