in reply to Tk: Aligning the items in seperate canvases
Try this.
sub AlignAll{ foreach my $i (0 .. 3) { my( $x1, $y1, $x2, $y2 ) = $sc[$i]->bbox('rect'); my $location =int(($x1+$x2)/2); ## The location minus half the width of the window ## Over the scaled width of the drawing my $abs = ( $location - 200 ) / ( $initial_width * $scale ); $sc[$i]->xviewMoveto( $abs ); } }
With the addition of -confine => 0 when you create your canvases,
$sc[$i] = $tile[$i]->Scrolled('Canvas', -confine => 0, -scrollbars => 'os', -scrollregion => [0, 0, $initial_width, 125], -width => 400, -height => 125, -background => randColor() )->pack(qw/-fill both -side top -expand 1/);
it aligns and centres the boxes at all scales from when the entire arrow is just a blob through to the box being bigger than the window.
|
|---|