Dear monks
It is easy to display an image into a Tk widget, for instance, a Label or a Text widget. All examples I have seen refer to image files stored locally. I want to show images available on a server for which I have a URL. Is there an alternative to downloading the file image locally and then show it in Tk? A little bit like a Browser (which I think does not save all images locally to display them).
If there is no alternative than downloading the file locally, I try to to write the image to a temporary file:
use LWP::Simple; use File::Temp; my $tempFile = new File::Temp( UNLINK => 0, SUFFIX => '.jpg' ); #my $tempFile = 'img.jpg'; my $url='https://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Win +d_turbines_in_southern_California_2016.jpg/200px-Wind_turbines_in_sou +thern_California_2016.jpg' getstore($url, $tempFile);
Unfortunately my file is empty, and I do not get any error message! If I write it to an ordinary directory, however, I can download the file fine. Any idea?
In reply to Tk show image from web by IB2017
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |