$VERSION = '3.018'; # $Id: //depot/Tk8/Tk/Animation.pm#18 $
Construct Tk
::Widget
'Animation';
return shift->{'_MainWIndow_'};
$obj->{'_frames_'} = [] unless exists $obj->{'_frames_'};
push(@
{$obj->{'_frames_'}},@_);
my ($class,$widget,%args) = @_;
my $obj = $class->SUPER::new
($widget,%args);
$obj->{'_MainWIndow_'} = $widget->MainWindow;
if ($args{'-format'} eq 'gif')
$args{'-format'} = "gif -index $index";
eval {local $SIG{'__DIE__'}; $img = $class->SUPER::new
($widget,%args) };
$obj->add_frame(@images);
$obj->{'_frame_index_'} = 0;
my $frames = $obj->{'_frames_'};
return unless $frames && @
$frames;
$index = 0 unless $index < @
$frames;
$obj->copy($frames->[$index]);
$obj->{'_frame_index_'} = $index;
my $frames = $obj->{'_frames_'};
return unless $frames && @
$frames;
$obj->set_image((($obj->{'_frame_index_'} || 0)+1) % @
$frames);
my $frames = $obj->{'_frames_'};
return unless $frames && @
$frames;
my $w = $obj->MainWindow;
$obj->{'_NextId_'} = $w->repeat($period,[$obj,'next_image']);
my $id = delete $obj->{'_NextId_'};
Tk
::catch
{ $id->cancel } if $id;
# This almost works for changing the animation on the fly
# but does not resize things correctly
my $widget = $obj->MainWindow;
$args{'-format'} = "gif -index $index";
my $img = $widget->Photo(%args);
delete $obj->{'_frames_'};
$obj->add_frame(@images);
$obj->configure(-width
=> 0, -height
=> 0);