Hi, here is a little example which should show you the ropes on handling the scrollbar options. It is slightly exaggerated for demo purposes. :-)
#!/usr/bin/perl use strict; use Tk; use Tk::Pane; my %frames; my %subframes; my %labels; my %buttons; my $mw = MainWindow->new; my $pane = $mw->Scrolled("Pane", -scrollbars => 'se', -sticky => 'nsew', -bg => 'black', -width => 300, -height => 300 )->pack(-expand => 1, -fill => 'both'); my $realpane = $pane->Subwidget('scrolled'); my $xbar = $pane->Subwidget('xscrollbar'); my $ybar = $pane->Subwidget('yscrollbar'); $ybar->configure(-background=>'blue', -activebackground=>'blue', -troughcolor => 'black', -width=> 50); $xbar->configure(-background=>'green', -activebackground=>'green', -troughcolor => 'black', -width=> 50); foreach my $row (0 .. 3) { $frames{$row} = $pane->Frame(-bg => 'black')->pack( -padx => 5, -pady => 5, -expand => 1, -fill => 'both', -anchor => 'nw', ); foreach my $col (0 .. 3) { createTile($row, $col); } } MainLoop; sub createTile { my ($row, $col) = @_; $subframes{$row}{$col}{'mainframe'} = $frames{$row}->Frame( -bg => 'black')->pack( -side => 'left', -padx => 5, -pady => 5, -expand => 1, -fill => 'both', -anchor => 'nw', ); my $frame = $subframes{$row}{$col}{'mainframe'}; my $sc = $frame->Scrolled('Canvas', -scrollbars => 'osoe', -scrollregion => [0, 0, 1200, 1200], -width => 125, -height => 125, -background => randColor() )->pack(-fill=>'both',-expand => 1, -side =>'top'); my $count = int(rand(6)) + 2; foreach my $i (1 .. $count) { my ($x, $y) = (randNumber(), randNumber()); my $size = randNumber(); $sc->createRectangle($x, $y, $x+$size, $y+$size, -fill => randColor(), -outline => 'black', -width => 2 ); } #miniframe for labels $subframes{$row}{$col}{'subframe_a'} = $frame->Frame( -bg => 'black')->pack(-side => 'top',-expand=> 1,-fill=>'bo +th'); #mini frame for buttons $subframes{$row}{$col}{'subframe_b'} = $frame->Frame( -bg => 'black')->pack(-side => 'top',-expand=> 1,-fill=>'bo +th'); #labels $labels{$row}{$col}{1} = $subframes{$row}{$col}{'subframe_a'}->Labe +l( -text => "$row - $col" , -bg => 'black', -fg => 'green', )->pack(-side => 'left', -padx => 5); $labels{$row}{$col}{2} = $subframes{$row}{$col}{'subframe_a'}->Label +( -text => "$row - $col" , -bg => 'black', -fg => 'hotpink', )->pack(-side => 'right', -padx => 5); #buttons $buttons{$row}{$col}{1} = $subframes{$row}{$col}{'subframe_b'}->Butt +on( -text => " Zoom Out ", -command => sub { $sc->scale(qw/all 0 0 .5 .5/); } )->pack(-side => 'left', -padx => 5); $buttons{$row}{$col}{2} = $subframes{$row}{$col}{'subframe_b'}->Butt +on( -text => " Zoom In", -command => sub { $sc->scale(qw/all 0 0 2 2/); } )->pack(-side => 'right', -padx => 5); } sub randColor { my @colors = qw(red yellow blue orange green purple); return $colors[rand($#colors + 1)]; } sub randNumber { my ($max, $min) = (100, 10); my $size = int(rand($max)); $size += $min if $size < $min; return $size; }

In reply to Re: Perl Tk Panes/Frames (probably simple) by Anonymous Monk
in thread Perl Tk Panes/Frames (probably simple) by MountainDon't

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.