Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cannot open '\icon.gif' in mode 'r' at C:/Perl/site/lib/Tk/Image.pm line 21

550 views
Skip to first unread message

Bob

unread,
Apr 24, 2003, 11:56:56 PM4/24/03
to
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');
$button->configure( image =>$icon, command => sub {exit;} );
$label->pack(side => 'left');
$button->pack(side => 'left', padx => 5 );

MainLoop();

Slaven Rezic

unread,
Apr 25, 2003, 4:40:14 AM4/25/03
to
bbo...@pacbell.net (Bob) writes:

> 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

Bob

unread,
Apr 25, 2003, 2:50:36 PM4/25/03
to
Slaven Rezic <sla...@rezic.de> wrote in message news:<87d6jb6...@vran.herceg.de>...

> (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.

0 new messages