http://www.perlmonks.org?node_id=105347


in reply to (ichimunki) Re x 3: Tk::JPEG
in thread Tk::JPEG

Brrr...you're right! I was way too quick with my answer! It should be this:
my $mw = MainWindow->new; my $photo = $mw->Photo( "photo" -format => 'jpeg', -file => 'test.jpg' ); my $button = $mw->Button(-image => "photo")->pack(); MainLoop;


Jouke Visser, Perl 'Adept'
Using Perl to help the disabled: pVoice and pStory

Replies are listed 'Best First'.
(ichimunki) Re x 5: Tk::JPEG
by ichimunki (Priest) on Aug 16, 2001 at 17:06 UTC
    Now that's a trick worth knowing about! Keeping all image widgets as children of the MainWindow rather than in the widgets themselves makes managing them a lot easier (flipping images in Tk is a terrible memory leak unless done very carefully). It also allows for sharing a single photo widget among several other widgets if needed without having to reparent the original photo each time.
Re^2: (ichimunki) Re x 3: Tk::JPEG
by padawan_linuxero (Scribe) on May 15, 2008 at 22:52 UTC
    Hi looking for something like this just to give me an idea I notice a missing comma it should be like this ?
    my $mw = MainWindow->new; my $photo = $mw->Photo( "photo", -format => 'jpeg', -file => 'test.jpg' ); my $button = $mw->Button(-image => "photo")->pack(); MainLoop;
    Or am I wrong?
    Thanks with the example you help me nail the problem
    THANKS!!!!!