Fellow monks,
I have looked at the Tk faq and am still stumped on this one.
I'm trying to draw a canvas and place a gif file upon said canvas.
Going to the Tk faq and replacing the file, I have the following code:
#!/usr/bin/perl -w
use strict;
use Tk;
my $main = new MainWindow;
my $canvar = $main ->Canvas;
$canvar->pack;
my $file = 'c:\html\atomic\0.gif';
my $img = $canvar->Photo(
'IMG',
-file => Tk->findINC($file) );
$canvar->create(
'image',0,0,
'-anchor' => 'nw',
'-image' => $img );
MainLoop;
__END__
What I'm getting is a lovely canvas, but no picture.
At present I'm working on a windows machine and will have do demo this on a windows machine, so my questions are:
- Do I have the file path wrong? Is perl not understanding that?
- Is there something else wrong with the code there that I'm not seeing?
- Why place the __END__ after MainLoop with nothing going on? I thought code placed below MainLoop would execute for cleanup or whatever anyway.
Thanks for any and all help on this one. Sometimes getting your interface right is worse than the underlying code to make it all work. :)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.