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

Hi!

The data you receive from encode_photo_data() is not a file, so you have to use Photo(-data=>...):

$encoded_pic = encode_photo_data("up.bmp"); my $pic = $top->Photo(-data=>$encoded_pic);
or in one line:
my $pic = $top->Photo(-data=>encode_photo_data("up.bmp"));
Regards, mawe

Replies are listed 'Best First'.
Re^6: Bitmap for beginners (Perl Tk)
by TonyDonker (Novice) on Feb 16, 2005 at 10:46 UTC
    This works also fine:

    use Tk;<br/> my $top = new MainWindow;<br/> my $pic = $top->Photo(-file=>"img/hals.gif");<br/> $top->Button(-image=>$pic)->pack();<br/> MainLoop();<br/><br/>
    a .GIF instead of a .BMP