smackdab has asked for the wisdom of the Perl Monks concerning the following question:
I know it is my fault, but it seems that I have asked for a JPEG format and then passed a JPEG format ??? Is this what they call "weak typing"?use Tk; use Tk::JPEG; use GD::Graph::lines3d; use strict; my $mw = new MainWindow; my @data = ( ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], [ 1203, 3500, 3973, 2859, 3012, 3423, 1230] ); my $graph = new GD::Graph::lines3d(100, 100); $graph->set( x_label => 'Day', y_label => 'Hits', title => 'Summary', ); my $gd = $graph->plot(\@data); # Works my $a = $mw->Photo('img1', -format=>'JPEG', -file=>"test.jpg"); # Doesn't work (couldn't recognize image data) #my $b = $mw->Photo('img2', -format=>'JPEG', -data=>$gd->jpeg); # Works - writes image to file (and it is the graph!) open(IMG, '>abc123.jpeg') or die $!; binmode IMG; print IMG $gd->jpeg; close(IMG); # Doesn't work, (couldn't recognize image data) #$mw->Label(-image=>$gd->jpeg) # ->pack(-fill=>'both'); # Works $mw->Label(-image=>'img1') ->pack(-fill=>'both'); MainLoop;
Edit kudra, 2001-09-26 Added code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: passing anything from GD to Tk ???
by Jouke (Curate) on Sep 28, 2001 at 11:04 UTC | |
by smackdab (Pilgrim) on Oct 21, 2001 at 08:26 UTC | |
|
(mitd) Re: passing anything from GD to Tk ???
by mitd (Curate) on Sep 26, 2001 at 10:27 UTC | |
by smackdab (Pilgrim) on Sep 26, 2001 at 19:00 UTC |