in reply to Re^2: Tk: Does the 'grid' geometry manager has a problem with a scrolled parent?
in thread Tk: Does the 'grid' geometry manager has a problem with a scrolled parent?

I would make a main Scrolled Pane. Then in that Scrolled Pane, place your Scrolled Canvases in a series of stacked frames. You can use packForget to repack them according to user choice.
#!/usr/bin/perl use strict; use Tk; use Tk::Pane; my $mw = MainWindow->new; $mw->geometry('400x250'); my $mwf = $mw->Scrolled('Pane', -scrollbars=>'osoe', -sticky=>'nwse', )->pack(-expand=>1, -fill=>'both'); my $f1 = $mwf->Frame()->pack(); my $f2 = $mwf->Frame()->pack(); my %canv; for (0..4){ $canv{$_}{'obj'} = $f1->Scrolled('Canvas', -height => 100, -width => 100, -bg =>'white', -scrollbars => 'osoe', -scrollregion => [ 0, 0, 500, 500 ], )->pack(-side =>'left' ,-padx=>10,-pady=>10); $canv{$_}{'obj'}->createText(50,50, -text => $_, -anchor => 'center', ); } for (5..9){ $canv{$_}{'obj'} = $f2->Scrolled('Canvas', -height => 100, -width => 100, -bg =>'white', -scrollbars => 'osoe', -scrollregion => [ 0, 0, 500, 500 ], )->pack(-side =>'left', -padx=>10,-pady=>10 ); $canv{$_}{'obj'}->createText(50,50, -text => $_, -anchor => 'center', ); } MainLoop();

I'm not really a human, but I play one on earth. Cogito ergo sum a bum
  • Comment on Re^3: Tk: Does the 'grid' geometry manager has a problem with a scrolled parent?
  • Download Code