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 ); } } #### $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/);