Debian Codegraph @

Contrib/TickerTape

raw
1 #!/usr/local/bin/perl
2
3 =head1 NAME
4
5 TickerTape - Display long message in Tk
6
7 =head1 SYNOPSIS
8
9 TickerTape Message
10
11 =head1 DESCRIPTION
12
13 For everyone with a case of Browser envy after using Microsoft's Internet
14 Explorer, here's a perl/tk script only slightly more useful than a script
15 to do <BLINK>. Don't know why I wrote it. Don't know why you'd run it.
16 Maybe if you were writing a ticker tape application. Or had a weird thing
17 for Times Square. Anyway....
18
19 tog
20 Terry Greenlaw (on-site @ Lockheed Martin) Encompass Technologies
21 [email protected] [email protected]
22
23 =cut
24
25
26 use Tk;
27
28 $top = MainWindow->new;
29
30 $message= (@ARGV) ? join(' ',@ARGV) : "THIS IS A VERY LONG SCROLLING MESSAGE... ";
31 $l1 = $top->Label(-fg=>'White',-text=>'This is the top of the screen');
32 $l1->pack( -fill => 'both', -expand => 1 );
33 $m1 = $top->Label(-fg=>'Red', -bg=>'black',
34 -textvariable => \$message, -width => 15 );
35 $m1->pack();
36 $m2 = $top->Label(-wrap=>1, -fg=>'Green', -bg=>'black',
37 -textvariable => \$message2, -width=>1, -height=>8 );
38 $m2->pack(-anchor=>'w');
39 $l2 = $top->Label(-fg=>'White',-text=>'This is the bottom of the screen');
40 $l2->pack( -fill => 'both', -expand => 1 );
41 after(100, \&scroll_it);
42 $top->MainLoop;
43
44 sub scroll_it {
45 $message =~ /(.)(.*)/;
46 $message="$2$1";
47 ($message2 = $message) =~ s/ / /g;
48 $top->after(200, \&scroll_it);
49 }