The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tk::SevenSegmentDisplay - Perl extension for simulating a seven-segment display

SYNOPSIS

 use Tk::SevenSegmentDisplay;
 my $mw = MainWindow->new();
 my $ssd = $mw->SevenSegmentDisplay(
        -digitwidth     => 100,
        -digitheight    => 200,
        -space          => 5,
        -format         => 'dd:dd:dd',
        -background     => '#00FF00',
        -foreground     => '#0000FF'
        )->pack();
 
 my $ssd = $mw->SevenSegmentDisplay()->pack();
 $ssd->configure(
        -digitwidth     => 80,
        -digitheight    => 160,
        -space          => 8,
        -format         => 'ddd.ddd.ddd.ddd',
        -background     => '#0000FF',
        -foreground     => '#FF0000'
        );
  $ssd->CalculateDisplay();
  $ssd->repeat(1000, sub
        {
        $ssd->SetValue($value);
        # $ssd->SetInt($value);

        $ssd->DrawNew();
        # $ssd->ChangeColor();
        # $ssd->ChangeSequence();
        });

DESCRIPTION

Perl extension for simulating a seven-segment display. The display can be changed in size and color. Furthermore can points, colons and hyphens being added.

CONSTRUCTOR AND INITIALIZATION

 use Tk::SevenSegmentDisplay;
 my $mw = MainWindow->new();
 my $clock = $mw->SevenSegmentDisplay(
        -digitwidth     => 60,
        -digitheight    => 100,
        -space          => 10,
        -format         => 'dd:dd:dd',
        -background     => '#C0C0C0',
        -foreground     => '#FF0000'
        );
 $clock->CalculateDisplay();
 $clock->pack();

METHODS

CalculateDisplay(void)

Calculates and draws the display new. This function must be called after every initialization or configuration.

DrawNew(void)

Draws the whole display new. Should be called after SetValue() or SetInt is called, to draw the changes of the values.

ChangeColor(void)

Exchanges the foreground- and background color. Should be called after SetValue() or SetInt() is called, to show the changes of the values.

ChangeSequence(void)

Changed the sequence of the segments in the display. Should be called after SetValue() or SetInt() is called, to show the changes of the values.

SetValue(unsigned int, unsigned int)

The first argumet is the number of the digit in the display which is to be changed. The left digit = 1. ddd.ddd 123.456 The second argumet is the value which is to be shown. 0..9

SetInt(int)

Takes a signed number which is to be shown in the display. To be able to show the sign, the format of the display must begin with a hyphen. '-dddddd'

WIDGET SPECIFIC OPTIONS

-digitwidth

The width of one digit in pixel. default = 33

-digitheight

The height of one digit in pixel. default = 58

-space

The space between two digits in pixel. default = 3

-format

A string containing: 'd' or 'D' = digit [dD.-:] Examples: 'dd:dd:dd' 'ddd.ddd.ddd.ddd' 'dd-dd-dddd' '-dddddd' default = 'dd.dd'

-background

default = '#00C800'

-foreground

default = '#006400'

INSERTED WIDGETS

<SevenSegmentDisplay>

It is a canvas widget which shows the digits.

EXPORT

None by default.

SEE ALSO

http://freenet-homepage.de/torstenknorr

KEYWORDS

seven-segment display

BUGS

Maybe you'll find some. Please let me know.

AUTHOR

Torsten Knorr, <create-soft@freenet.de>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Torsten Knorrr

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.9.1 or, at your option, any later version of Perl 5 you may have available.

6 POD Errors

The following errors were encountered while parsing the POD:

Around line 489:

'=item' outside of any '=over'

Around line 524:

You forgot a '=back' before '=head1'

Around line 526:

'=item' outside of any '=over'

Around line 561:

You forgot a '=back' before '=head1'

Around line 563:

'=item' outside of any '=over'

Around line 567:

You forgot a '=back' before '=head2'