Version 1 of An arc clock

Updated 2004-12-25 11:04:50 by suchenwi

if 0 {Richard Suchenwirth 2004-12-25 - I don't know why, but this Xmas somehow unusual clocks interest me most. Here's a very simple one with 24 hour display (the black/white disk) plus minutes (the red arc running round the disk).

http://mini.net/files/arcclock.gif

Black and white obviously stand for day and night; by the angle of the black/white divide you can tell the hour (noon is horizontal with white up, midnight is horizontal with black up) measured at top of the disk. The minute display allows reading at roughly 5 minutes precision. The screenshot was taken at 11:49.

The GUI is just a canvas with three items: }

 package require Tk

 pack [canvas .c -width 60 -height 60]
 .c create arc 5 5 55 55 -fill red -outline red \
    -start 90 -tag min
 .c create oval 10 10 50 50 -fill white -outline white
 .c create arc 10 10 50 50 -fill black -extent 180 -tag night

#-- I need this every now and then :)

 proc every {ms body} {eval $body; after $ms [info level 0]}

 proc update'arc'clock w {
    scan [clock format [clock sec] -format %H] %d hour
    scan [clock format [clock sec] -format %M] %d minute
    $w itemconfig night -start [expr ($hour+$minute/60.)*-15]
    $w itemconfig min -extent [expr $minute*-6]
 }
 every 1000 {update'arc'clock .c}

 bind . <Escape> {exec wish $argv0 &; exit}

if 0 {


Category Date and Time | Arts and crafts of Tcl-Tk programming }