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

I receive the message:
Cannot open '

***lots of binary data***

' in mode 'r' at ../Image.pm line 21

Replies are listed 'Best First'.
Re^5: Bitmap for beginners (Perl Tk)
by mawe (Hermit) on Feb 16, 2005 at 10:21 UTC
    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
      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