Kandankarunai has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks, The following code gives "Cannot open 'valentine_prev.jpg' in mode 'r' at C:/Perl/lib/Tk/Image.pm line 21".......... how to rectifying that error....
use Tk; use Tk::PNG; my $mw = MainWindow->new ( -title => 'KK', ); $mw->geometry ('200x30'); my $icon = $mw->Photo ( -file => 'valentine_prev.jpg', -format => 'PNG', -width => 32, -height => 32, ); $mw->iconimage ($icon); MainLoop;

Replies are listed 'Best First'.
Re: Error in icon
by chromatic (Archbishop) on Apr 08, 2011 at 05:43 UTC

    What happens if you use Tk::JPEG and format => 'JPEG' instead?

Re: Error in icon
by cdarke (Prior) on Apr 08, 2011 at 08:52 UTC
    Check that the file exists, and that the user running the program has read access (permissions).