Version 10 of LED

Updated 2004-11-22 19:55:09

LED stands for light-emitting diode. Often people use LED to refer to astyle of graphical display that resembles this type of electronic component.


David Wijnants writes, "[...] http://www.xs4all.nl/~arjenvm/pics/index.html has lots of icons 'n stuff, including red and green 'bullets'. Just stick a .GIF image on a canvas, or in a label, and switch images when you need to - for example :

      image create photo red -file smb_red.gif
      image create photo green -file smb_green.gif
      pack [ label .led -image red -height 50 -width 50 ]
      pack [ button .red -text Rood -command { .led configure -image red
            } ] -fill x
      pack [ button .green -text Groen -command { .led configure -image green
            } ] -fill x

With Mark G. Saye's led package [L1 ], "you can create leds (labels) with different sizes and colors, and you can flash them (toggle bg/fg colors and normal/active states), disable (and resume) flashing. There's even a demo for Knight Rider fans."

 Identifier: led
 Version: 0.0.2
 Title: A library of led routines.
 Creator: Mark G. Saye <[email protected]>
 Description: Provides routines for leds. 
 Rights: BSD
 URL: http://www.binarism.com/tk/
 Available: 2003-04-20
 Architecture: tcl
 Type: Software
 Subject: led
 Language: en

DKF does it this way:

      ### MAKE AN IMAGE ###
      image create photo led10x5 -width 10 -height 5
      led10x5 put -to 0 0 10 1 grey40
      led10x5 put -to 0 0 1 5 grey40
      led10x5 put -to 9 0 10 5 grey40
      led10x5 put -to 0 4 10 5 grey40
      ### EASY COLOUR CONFIG ###
      array set ledcols {red red1 green green1 off grey25}
      ### UTILITY PROCS ###
      proc makeLED {w {initState off}} {
         global ledcols
         label $w -image led10x5 -bg $ledcols($initState) -bd 0
      }
      proc setLED {w state} {
         global ledcols
         $w configure -bg $ledcols($state)
      }

Other code and commentary on the same subject appears in [L2 ].


Category Graphics | Category Acronym