in reply to Animation using Tkx

Try looking into the source code of Tk::Animation.

It looks like it creates a new Tk::Photo object for each index of the image, using `-format "GIF -index $index"`:

sub new { my ($class,$widget,%args) = @_; my $obj = $class->SUPER::new($widget,%args); $obj->{'_MainWIndow_'} = $widget->MainWindow; if ($args{'-format'} eq 'gif') { my @images; local $@; while (1) { my $index = @images; $args{'-format'} = "gif -index $index"; my $img; eval {local $SIG{'__DIE__'}; $img = $class->SUPER::new($widget,% +args) }; last if $@; push(@images,$img); } if (@images > 1) { $obj->add_frame(@images); $obj->{'_frame_index_'} = 0; } } $obj->set_image( 0 ); $obj->_get_gif_info; return $obj; }

Tk::Animation basically just creates a ton of Photo objects, and a label, and then with a $tk->repeat loop, it updates the label with the next image in the animation.

sub start_animation { my ($obj,$period) = @_; my $frames = $obj->{'_frames_'}; return unless $frames && @$frames; my $w = $obj->MainWindow; $obj->stop_animation; $obj->{'_period_'} = $period if $period; $obj->{'_NextId_'} = $w->repeat($obj->{'_period_'},[$obj,'next_image_ +in_animation']); }

It should be trivial to re-implement this module in Tkx. If Tkx doesn't have a "-index" option in the image's -format you may need to use an external module like Imager to split up the frames of the gif, and make a new Photo object or similar for each frame.