Debian Codegraph @

examples/animate

raw
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