in reply to TK Photo Cam - Memory Leak

Hi,
You seem to be creating new Photo objects with every iteration ...
Instead of recreating the $buttonImage = $mw->Photo(-data => $data, -format => 'jpeg');,
you can opt for using the configure method on it ...
You also do not need to use the Button, a Label suffices.

... use Tk; use Tk::JPEG; ... my $mw = MainWindow->new(); my $image = $mw->Photo(); $mw->Label( -image=>$image )->pack; ... sub update_image { ... $image->configure( -format => 'jpeg', -data => $data ); $mw->update; ... }


regards,
johanvdb

Replies are listed 'Best First'.
Re: Re: TK Photo Cam - Memory Leak
by Anonymous Monk on Jul 15, 2002 at 22:37 UTC
    Thanks for the reply and the info on the label !!