in reply to Re: Bitmap for beginners (Perl Tk)
in thread Bitmap for beginners (Perl Tk)

Hi zentara,

when trying to load a .jpg with the following:

use Tk;
use Tk::JPEG;
my $top = new MainWindow;
my $pic = $top->Photo(-file=>"arrow.jpg");
$top->Button(-image=>$pic)->pack();
MainLoop();

I receive the message:

Can't locate Tk/JPEG.pm in @INC (@INC contains:
E:/Perl/lib E:/Perl/site/lib .)
at E:\As2ConGUI\work\bitmap.pl line 2.
BEGIN failed--compilation aborted at
E:\As2ConGUI\work\bitmap.pl line 2.

I have installed the correct Perl extensions...

Thanks,

Ton

Replies are listed 'Best First'.
Re^3: Bitmap for beginners (Perl Tk)
by zentara (Cardinal) on Feb 16, 2005 at 13:18 UTC
    I use linux, and your code works, except for one thing...'arrow.jpg' is not in the current directory. So I don't know what your windows problem is. I would guess that you have an old perl version, and you need to get Tk::JPEG as a separate ppm(it's standard in the newer Perl versions). Also, unless 'arrow.jpg' is a file in the current script directory, you will need to specify the full path to it, or use something like:
    (-file => Tk->findINC('arrow.jpg'))

    I'm not really a human, but I play one on earth. flash japh