Version 14 of Analog widgets

Updated 2003-08-10 15:24:56

Marco Maggi The analog widgets are now (Aug 10, 2003) a package [L1 ].


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

[ Category Graphics | Category Widget | Category GUI ]