Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Animation/Perl/animation.pl
Normal file
27
Task/Animation/Perl/animation.pl
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
use Tk;
|
||||
use Time::HiRes qw(sleep);
|
||||
|
||||
my $msg = 'Hello World! ';
|
||||
my $first = '.+';
|
||||
my $second = '.';
|
||||
|
||||
my $mw = Tk::MainWindow->new(-title => 'Animated side-scroller',-bg=>"white");
|
||||
$mw->geometry ("400x150+0+0");
|
||||
|
||||
$mw->optionAdd('*Label.font', 'Courier 24 bold' );
|
||||
|
||||
my $scroller = $mw->Label(-text => "$msg")->grid(-row=>0,-column=>0);
|
||||
$mw->bind('all'=> '<Key-Escape>' => sub {exit;});
|
||||
$mw->bind("<Button>" => sub { ($second,$first) = ($first,$second) });
|
||||
|
||||
$scroller->after(1, \&display );
|
||||
MainLoop;
|
||||
|
||||
sub display {
|
||||
while () {
|
||||
sleep 0.25;
|
||||
$msg =~ s/($first)($second)/$2$1/;
|
||||
$scroller->configure(-text=>"$msg");
|
||||
$mw->update();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue