The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Tk::LCD - display Liquid Crystal Display symbols.


 use Tk::LCD;

 $lcd = $parent->LCD(-opt => val, ... );


Tk::LCD is a Canvas derived widget, based on a code snippet from Donal K. Fellows' Maze game. LCD symbols are displayed in elements composed of 8 segments, labeled "a" though "g", some on and some off. For instance, the number 8 requires one LCD element that has all 8 segments lit:


 a  | | c
     -      <------  g
 f  | | d


A Tk::LCD widget can consist of any number of elements, specified during widget creation. To actually display an LCD number, either invoke the set() method, or use the -variable option.

LCD elements can display a space, minus sign or a numerical diget, meaning that any positive or negative integer number can be displayed.

LCD elements can also be either large or small in size. If an LCD widget's size is small, then there is room enough between elements to display dots and commas. As a result, any positive or negative decimal number can be displayed. Additionally, numbers can be "commified", that is, commas are inserted every third digit to the left of the decimal point.


The following option/value pairs are supported:


Pertinent only if the LCD size is small, a boolean indicating whether a number is commified; that is, commas inserted every third digit. Default is 1.


The number of LCD elements (digits). Default is 5.


Outline color for ON segments.


Fill color for ON segments.


Outline color for OFF segments.


Fill color for OFF segments.


Size of LCD elements, either large or small (default is large).


A scalar reference that contains the LCD number to display. The widget is updated when this variable changes value.



Display $number in the LCD widget.


Component subwidgets can be accessed via the Subwidget method. This mega widget has no advertised subwidgets.


 $lcd = $mw->LCD(-variable => \$frog)->pack;
 $frog = 2001;



Copyright (C) 2001 - 2003, Steve Lidie. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


LCD, Canvas