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

I think it's a little strange to call a method on $button before you have declared $button with my $button. Maybe you patched your parser with a lookahead feature, "hey, do I declare this later, if so I can use it now, right?" :)

Replies are listed 'Best First'.
Re: (ichimunki) Re x 3: Tk::JPEG
by Jouke (Curate) on Aug 16, 2001 at 16:50 UTC'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
      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.
      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