Front page | perl.tcltk |
Postings from May 2012
From: gary sachs
May 4, 2012 04:08
Message ID: 1336129722.36068.YahooMailNeo@web160906.mail.bf1.yahoo.com
I can give that a try. I have seen the Tkx::eval used with a single line command, but not a whole procedure. So, can you point me to some examples of how to do this? Or can I just inside my PERL code doe something like:
do some PERL things with the canvas....
do some more PERL things
image create photo $image \
-height $height -width $width
more PERL code...
From: Jeff Hobbs <firstname.lastname@example.org>
To: gary sachs <email@example.com>
Cc: 'Tcl/ Tk Mailing List' <firstname.lastname@example.org>
Sent: Thursday, May 3, 2012 6:27 PM
Subject: Re: Img
On 03/05/2012 1:54 PM, gary sachs wrote:
> I did find the img::window which has pushed me further down the road. But, it leads me to some questions about trying to write a PNG or JPEG file of a canvas. When I do the writing, it seems that it can take 10 seconds or longer to complete and then there is only a partial drawing in the PNG file. So, here is the small code fragment I am trying...
> my $img = Tkx::image_create_photo(-data => $mycanvas, -format => 'window');
> $img = Tkx::widget->new($img);
> $img->write ($filename, -format => 'JPEG');
> ... again it works so to speak.
> How do I get the entire visble canvas into the PNG? Or for that matter, how would I get the entire canvas, visible objects and not visible in the window, written to the PNG file? Any way to speed things up? I would like to not have to resort to IMAGEMAGICK and GHOSTSCRIPT if possible.
I'm not sure why it would take 10 seconds, though if $mycanvas is really large, it may be passing a lot of data over the Perl<>Tcl bridge. Note that the 'window' format really is about just capturing the visible window. There are numerous tricks and techniques that people have tried to get the whole canvas. They are best shown here:
Try the canvas2Photo method shown there. Remember that you can just push this all to Tcl with an eval call rather than try and translate it to Perl.