#!/usr/bin/perl -w use strict; use LWP::Simple; use Tk; use Tk::DialogBox; my $url="http://www.hpc.ncep.noaa.gov/noaa/noaa.gif"; my $file="noaa.gif"; my $MW=MainWindow->new(-title=>"NOAA/NWS/NCEP Current U.S. Forecast Map"); ### --- Prevents Main Window Resizing $MW->bind('' => sub{ my $xe = $MW->XEvent; $MW->maxsize($xe->w, $xe->h); $MW->minsize($xe->w, $xe->h); }); print "Please Wait...\nAcquiring Image from www.hpc.ncep.noaa.gov ....\n"; my $status=getstore($url,$file); if ($status==500){ my $exit = $MW->Button(-text => "500-NETWORK ERROR Unable to Communicate with Host\nCheck your Network Connection!\n Click to EXIT", -foreground => 'red', -background => "yellow", -activebackground => "red", -font => 'Arial', -command => sub { exit; }); $exit->pack; MainLoop(); } if ($status==404){ my $exit = $MW->Button(-text => "404-ERROR FILE MISSING\nImage is Temporarily Unavailable on Server\n Click to EXIT", -foreground => 'red', -background => "yellow", -activebackground => "red", -font => 'Arial', -command => sub { exit; }); $exit->pack; MainLoop(); } print "generating Tk Window ....\n"; my $image = $MW->Photo(-file=>"noaa.gif", -width=>896, -height=>716); $MW->Button(-image=>$image, -width=>896, -height=>716, -command => sub { my $dialogA = $MW->DialogBox( -title => "About This Image", -buttons => [ "OK" ], ); $dialogA->add("Label", -borderwidth => '2', -background => "#FAEBD7", #ANTIQUE WHITE -font => 'bold', -justify => 'left', -relief => 'sunken', -text => "This Image is Produced by:\n National Weather Service Hydrometeorological Prediction Center\n http://www.hpc.ncep.noaa.gov/ \nThis forecast is updated daily \@ 09:00 UTC. ")->pack; ### --- Prevents Dialog Box Resizing $dialogA->bind('' => sub{ my $xeD = $dialogA->XEvent; $dialogA->maxsize($xeD->w, $xeD->h); $dialogA->minsize($xeD->w, $xeD->h); }); $dialogA->Show; } )->pack; MainLoop(); ############################################# ## TkForecastMap.pl ## version 1.0 -- 07/23/2003 by Jay Madigan ## This program is freeware and may be modified and/or redistributed ## under the same terms as the GNU public license of Perl. ## No warranty on this code is assumed or implied. #############################################