#!/usr/bin/perl -w use Tk; use strict; # Main program / GUI setup my $mw = MainWindow->new; my $c = $mw->Scrolled('Canvas', -width => 200, -height => 200)->grid; $c->configure(-background =>'blue', -scrollregion => [ 0, 0, 500, 500 ]); #Grid $c->createGrid(0, 0, 10, 10); $c->createGrid(0, 0, 100, 100, -lines => 1, -dash => '.-'); $c->pack(-expand => 1, -fill => 'both'); my $rect = $c->createRectangle(20, 20, 40, 40, -outline => 'yellow', -fill => 'yellow'); MainLoop; #### #!/usr/bin/perl -w use Tk; use strict; my $mw = MainWindow->new; $mw->geometry('300x300'); #try this my $c = $mw->Scrolled('Canvas', -width => 200, -height => 200, -background =>'blue', -scrollregion => [ 0, 0, 500, 500 ] )->pack(-expand => -2, -fill => 'both'); $c->createRectangle(100, 100, 150, 150, -fill => 'red'); $c->createRectangle(100, 400, 150, 450, -fill => 'green'); my $plus = $c->Button( -text => ' + ', -command => sub {$c->scale("all", 125, 125, 2, 2); } ); $plus->pack; my $minus = $c->Button( -text => ' . ', -command => sub {$c->scale("all", 125, 125, 0.5, 0.5); } ); $minus->pack; MainLoop;