Cannot open '\icon.gif' in mode 'r' at C:/Perl/site/lib/Tk/Image.pm
line 21.
Help!!! Is the sample old, bad or is my install bad? Any clues? TIA.
#!c:/Perl/bin/Perl.exe
use Tk;
$main = MainWindow->new();
$main->title("Hello TK World!");
$label = $main->Label(text => 'Hello from Tk, ya all.');
$button = $main->Button();
$icon = $button->Photo(-file => '\icon.gif');
$button->configure( image =>$icon, command => sub {exit;} );
$label->pack(side => 'left');
$button->pack(side => 'left', padx => 5 );
MainLoop();
> The Tk script below is from "Perl: The Complete Reference". You can
> tell I'm a newbie since I'm stuck over sample code, hehe. I use the
> Win2K and all the related files seems to be in place, Perl, and Tk,
> etc. When I open a command window and execute the script I get this
> message:
>
> Cannot open '\icon.gif' in mode 'r' at C:/Perl/site/lib/Tk/Image.pm
> line 21.
>
> Help!!! Is the sample old, bad or is my install bad? Any clues? TIA.
>
> #!c:/Perl/bin/Perl.exe
> use Tk;
> $main = MainWindow->new();
> $main->title("Hello TK World!");
> $label = $main->Label(text => 'Hello from Tk, ya all.');
> $button = $main->Button();
> $icon = $button->Photo(-file => '\icon.gif');
This means that you should have a file named icon.gif on the current
(or C: ?) partition. Did you mean just "icon.gif"?
> $button->configure( image =>$icon, command => sub {exit;} );
> $label->pack(side => 'left');
> $button->pack(side => 'left', padx => 5 );
>
> MainLoop();
Regards,
Slaven
--
Slaven Rezic - sla...@rezic.de
tkrevdiff - graphical display of diffs between revisions (RCS or CVS)
http://ptktools.sourceforge.net/#tkrevdiff
> (or C: ?) partition. Did you mean just "icon.gif"?
ACK! I did not try double quotes! You, Sir are my hero for this whole day!
Slaven, Slaven he's the man! If he can't do it no one can!
Thanks.