lcdigit - A Dmhwidget for resizeable 7-segment digits


dmhwidgets::lcdigit pathName ?options?


itk::Widget <- dmhwidgets::Lcdigit


background cursor foreground height

See the options manual entry for details on the standard options.


Name: aspect  Class: Aspect  Command-Line Switch: -aspect  Default value: 2.0

Used as a floating point value to specify the ratio of vertical pixels to horizontal pixels used for the rectangular area allotted for the digit and its usual spacing.

Name: colon  Class: Colon  Command-Line Switch: -colon  Default value: 0

Used as a boolean to specify whether a colon should be drawn on the right of the digit as is useful for a clock.

Name: point  Class: Point  Command-Line Switch: -point  Default value: 0

Used as a boolean to specify whether a decimal point should be drawn on the right of the digit.

Name: tilt  Class: Tilt  Command-Line Switch: -tilt  Default value: 0

Used as a non-negative integer to specify the percentage by which the digit image slants to the upper-right.

Name: value  Class: Value  Command-Line Switch: -value  Default value: 8

The value to be displayed from 0..9, or one of the characters +, -, <space>, or E. The value e is displayed as E.


The lcdigit command creates a widget that depicts a 7 segment digit, and a new Tcl command whose name is pathname. The command is then used to invoke various methods of the widget. The command has the general form:

pathName option ?arg arg ... arg?

The lcdigit will resize itself to fill the available height. It will adjust its width to maintain the specified aspect ratio. Drawing the colon or the decimal point increases the width of the widget so that the usual spacing on both sides is preserved, with the digit being the same height and aspect ratio.




package require Dmhwidgets

frame .lcdigits -background grey22
pack .lcdigits -expand 1 -fill both -padx 4m -pady 4m
dmhwidgets::lcdigit .lcdigits.d1 -point 1
dmhwidgets::lcdigit .lcdigits.d2
dmhwidgets::lcdigit .lcdigits.d3
pack .lcdigits.d1 .lcdigits.d2 .lcdigits.d3 -side left -expand 0 -fill y 

# NOTE: If you want to aggregate digits to display numbers, you probably
#       want to use the lcdisplay widget.

proc lcdigits_show d {
   set d1 [expr int($d)]
   set d2 [expr int(10 * ($d - int($d)))]
   set d3 [expr int(10 * (10*$d - int(10*$d)))]
   .lcdigits.d1 configure -value $d1
   .lcdigits.d2 configure -value $d2
   .lcdigits.d3 configure -value $d3

lcdigits_show 3.27


Hume Integration Software,


digit  lcdisplay


digit, LCD, LED, 7-segment, widget