#!/usr/bin/perl use strict; use warnings; use Tk; my ($width, $height) = (1000, 500); my $cwidth = 3 * $width; sub func { $_ = shift; $_ / $width * $height % $height; } my $mw = MainWindow->new(-width => $width, -height => $height); $mw->packPropagate(0); # keeps MainWindow @ 1000x500 my $c = $mw->Scrolled('Canvas', -width => $cwidth + 2, -height => $height + 2, -scrollbars => 's')->pack; # draw a simple graph $c->create(line => $_, func($_), $_ + 1, func($_ + 1), -fill => 'red') for 1..$cwidth-1; $c->configure(-scrollregion => [ $c->bbox('all') ]); # THIS SOLVED THE PROBLEM # could also add: -scrollregion => [ 0, 0, 3000, 500 ], # to the constructor MainLoop;