Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tk display image path

Status
Not open for further replies.

Arepi

Technical User
Oct 23, 2008
17
HU
Hi,

I tryed this example from Tk FAQ to display en image.

use strict;
use Tk;
my $main = new MainWindow;
my $canvar = $main ->Canvas;
$canvar->pack;
my $file = 'demos/images/earth.gif';
my $img =
$canvar->Photo( 'IMG',
-file => Tk->findINC($file) );

$canvar->create( 'image',0,0,
'-anchor' => 'nw',
'-image' => $img );

MainLoop;

It worked fine but can only get image from Tk directory.
It possible get en image and display from anywhere on my PC?

Thanks a lot!
 
Try using an absolute path to the image
"C:\Documents and Settings\User\Dox\image.gif"

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Thanks! It works fine but dont whit a .png. What Ishould do to display a png image?

Thanks!

Arepi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top