On 2012-05-04, at 4:08 AM, gary sachs wrote:
> 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
That would be something like this:
Tkx::eval(<<'EOT');
# lots of Tcl code
# ...
EOT
Jeff
> 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:
> http://wiki.tcl.tk/1404
>
> 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.
>
> Jeff