[... light-emitting diode display ...]
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 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."
Donal K. Fellows 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 ].