"Fossies" - the Fresh Open Source Software Archive

Member "Tk-804.036/examples/animate" (15 Nov 2013, 647 Bytes) of package /linux/misc/Tk-804.036.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/local/bin/perl -w
    2 use Tk;
    3 
    4 my $mw = MainWindow->new;
    5 
    6 use strict;
    7 
    8 use Tk::widgets qw(Photo Animation);
    9 
   10 my $file = (@ARGV) ? shift : Tk->findINC('anim.gif');
   11 
   12 my $img = $mw->Animation('-format' => 'gif',-file => $file);
   13 
   14 my $lab = $mw->Label(-image => $img);
   15 
   16 my $start = $mw->Button(-text => 'Start', -command => ['start_animation' => $img]);
   17 my $stop  = $mw->Button(-text => 'Stop', -command => ['stop_animation' => $img]);
   18 my $quit  = $mw->Button(-text => 'Quit', -command => [destroy => $mw]);
   19 Tk::grid($lab,'-','-',-sticky => 'nsew');
   20 Tk::grid($start, $stop, $quit,-sticky => 'ew');
   21 $mw->gridRowconfigure(0,-weight => 1);
   22 MainLoop;
   23 
   24