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.
The image zooms, but the objects don't change at all. Instead, I get the following error message for the last line ($CW->scale...):#####----- 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);
Tk::Error: bad window path name "all" at review.pm line 335.Anyone know what I'm doing wrong here?
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)
In reply to Tk: Scaling canvas objects by perldough
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |