Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I rewrote your program before noting the "Bits I'm after" at the bottom -- I thought you wanted style suggestions. HTH, anyway.

#! /usr/bin/env perl use diagnostics; use strict; use Tk; use Time::HiRes; my $BG_COLOUR = $ENV{MY_BG_COLOUR} || "black"; my $FONT = $ENV{MY_FONT} || "-*-Matrix Code NFI-*-*-*--*-200-*"; # my $GIF = $ENV{MY_GIF} || "C:\\Perl\\tk\\prog2\\matx.gif"; my %MATRIX = (hip => ",\n", space => "\n"x14, onegap => " \n"); $MATRIX{$_} = "$_\n" for qw/a b c d e f g H i j k l n o r s w y/; my $ITERATIONS = $ENV{MY_ITERATIONS} || 0; my $main = MainWindow->new(-title => "Matrix...", -bg => $BG_COLOUR); $main->minsize(qw(422 200)); $main->maxsize(qw(422 200)); $main->idletasks; # necessary ! $main->iconimage($main->Photo(-file => $GIF)); $main->Frame(-bg => $BG_COLOUR)->pack(-side => 'left', -fill => 'y'); # -------------------------------------------------------------------- +-- package MatrixBoxes; sub new { my @m; for (1..3) { push @m, $main->Text(-width => "2", -background => $BG_COLOUR, -font => $FONT, -foreground => "lightgreen", -wrap => "none", -relief => 'flat')->pack(-side => 'right', -fill => 'y'); } bless \@m; } sub Contents { my $m = shift; for (@$m) { $_->Contents(@{+shift}) } } sub configure { my $m = shift; for (@$m) { $_->configure(@_) } } sub yscroll { my $m = shift; for (@$m) { $_->yviewScroll(shift, 'units +') } } # -------------------------------------------------------------------- +-- package main; my $m = MatrixBoxes->new; sub five{ my @let1 = @MATRIX{qw/d l r o w onegap o l l e H space/}; my @let2 = @MATRIX{qw/n i a g a onegap o l l e H space/}; my @let3 = @MATRIX{qw/onegap onegap onegap y o b onegap d a b onegap + onegap onegap onegap onegap space/}; $m->Contents(\@let1, \@let2, \@let3); $m->configure(-state => 'disabled'); $m->yscroll(37, 67, 27); for (1..27) { $m->yscroll(-1, -2, -1); $main->update; Time::HiRes::sleep(0.1); } } five for 0..$ITERATIONS; MainLoop;

In reply to Re: Matrix falling text effect by ayrnieu
in thread Matrix falling text effect by Anonymous Monk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2022-01-18 08:36 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (52 votes). Check out past polls.