Hi Monks,
I am trying to add a jpg file to my canvas but of no go. Here is the simple code that i am working with:
use Tk; use strict; my $mw = new MainWindow; $mw->geometry('600x600+110+110'); my $drawing = $mw->Canvas(-width => 500, -height => 500, -background => "white") -> pack; my $xpm = $drawing->createBitmap(0, 0, -bitmap => '@myfile.bmp'); my $xpm = $drawing->createImage(0, 0, -bitmap => '@myfile.jpg'); #$drawing->createOval(100,50,300,250,-fill=>"black"); #$drawing->createRectangle(150,100,250,200,-fill=>"red"); #$drawing->createText(200,275,-text=>"Some text on my drawing!",-ancho +r=>"center"); MainLoop();
Except the Bitmap and the image, i am able to create all other shapes (the lines that are commented) in the Canvas. I am receiving the below error message format error in bitmap dataerror reading bitmap file "myfile.bmp" at C:/Perl/site/lib/Tk.pm line 250.
Am i doing any thing wrong. Please guide me in right direction.

In reply to Images in Canvas by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.