I have a canvas named CW in which I have a picture and a whole bunch of overlain objects such as text and circles. I need to be able to zoom in on the picture and have the overlain objects stay at the same spot on the picture. I tried doing it like this.

#####----- Show zoomed picture -----##### # $zoom is number between -4 and 3; Negative for zoom-out and positiv +e for zoom-in as worked out in the conditional statement. # $img is the original image. # $zimg is the zoomed image. $zimg = $MW->Photo(); ($zoom > 0) ? $zimg->copy($img, -zoom => $zoom) : $zimg->copy($img, -subsample => ($zoom * -1)); $CW->createImage(0,0, -anchor => 'nw', -image => $zimg, -tags => 'dwg' +); ###-- Omited: Create objs in $CW w/ orig dims --### ###-- Scale objects --### $zfactor is one of (0.25, 0.3, 0.5, 1, 2, 3) my $zfactor = ($zoom > 0) ? $zoom : -1 / $zoom; $CW->scale('all', 0, 0, $zfactor, $zfactor);
The image zooms, but the objects don't change at all. Instead, I get the following error message for the last line ($CW->scale...):
Tk::Error: bad window path name "all" at review.pm line 335.
Tk callback for scale
RC::paint_Info at review.pm line 335
RC::__ANON__ at review.pm line 101
Tk callback for .toplevel.frame.labframe.border.frame1.radiobutton2
Tk::__ANON__ at C:/Perl/site/lib/Tk.pm line 250
Tk::Radiobutton::Invoke at C:/Perl/site/lib/Tk/Radiobutton.pm line 42
<Button-1>
(command bound to event)
Anyone know what I'm doing wrong here?

In reply to Tk: Scaling canvas objects by perldough

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.