Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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:
Am i doing any thing wrong. Please guide me in right direction.
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:
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.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();
Am i doing any thing wrong. Please guide me in right direction.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Images in Canvas
by Crian (Curate) on Nov 26, 2008 at 09:41 UTC | |
Re: Images in Canvas
by zentara (Archbishop) on Nov 26, 2008 at 14:52 UTC |
Back to
Seekers of Perl Wisdom