Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

(ichimunki) Re x 3: Tk::JPEG

by ichimunki (Priest)
on Aug 16, 2001 at 16:40 UTC ( #105346=note: print w/replies, xml ) Need Help??

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://105346]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2020-09-18 11:39 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (112 votes). Check out past polls.