Updated 2014-01-27 22:30:42 by uniquename

Marco Maggi The analog widgets are now (Aug 10, 2003) a package [1]. Updated with the aliasing code for lines (Sep 5, 2003).

A tachometer-like widget: type 1

A needlemeter widget: type 1 (an error in the title... RS fixed it)

A voltmeter-like widget: type 1

Here is a test script for the 3D circle border. See also: drawing gradients on a canvas, making color gradients and Gradients Color Transitions.

GPS This is cool! Thanks for sharing it. :)
 package require Tcl 8
 package require Tk  8
 
 proc main { argc argv } {
     global     forever
 
     wm withdraw .
     wm title   . "A shadowed 3D circle"
     wm geometry . +10+10
 
     canvas .c -background blue -width 400 -height 400
     grid .c -sticky news
 
     set num 10
     set xcentre 200
     set ycentre 200
     for {set i 0} {$i < $num} {incr i} {
        set radius      [expr {20.0*$i}]
        set orient      [expr {360.0/$num*$i}]
 
        set x1          [expr {$xcentre-$radius}]
        set y1          [expr {$ycentre-$radius}]
        set x2          [expr {$xcentre+$radius}]
        set y2          [expr {$ycentre+$radius}]
 
        shadowcircle .c $x1 $y1 $x2 $y2 40 3m $orient
     }
 
     wm deiconify .
     vwait forever
     exit 0
 }
 
 proc shadowcircle { canvas x1 y1 x2 y2 ticks width orient } {
     set angle $orient
     set delta [expr {180.0/$ticks}]
     for {set i 0} {$i <= $ticks} {incr i} {
        set a [expr {($angle+$i*$delta)}]
        set b [expr {($angle-$i*$delta)}]
 
        set color [expr {20+$i*(220/$ticks)}]
        set color [format "#%x%x%x" $color $color $color]
 
        $canvas create arc $x1 $y1 $x2 $y2 -start $a -extent $delta \
                -style arc -outline $color -width $width
        $canvas create arc $x1 $y1 $x2 $y2 -start $b -extent $delta \
                -style arc -outline $color -width $width
     }
 }
 
 main $argc $argv

___

uniquename 2014jan27

For those who do not have the facilities or time to implement the code above, here is an image of the 'shadowed 3D circle' Tk canvas produced by the code above.

It appears that if the gaps between the 'circles' were closed and all the dark shadows were moved to one side of the resulting 'disk', then one would see what would look like a pretty nicely shaded spherical dome.