In the perl tk code below, i use a create_tab subroutine to create several tabs (tk notebooks)
As the number of tabs grew i had a need to add a main window scroll bar using mw->Scrolled which would help me move to other tabs beyond the view of main window.
The addition of this scroll bar now makes my tabs not fill the main window height completely while it fits the main window width.
Would any of you monks be able to let me know what is wrong with my code which causes the vertical fit issue and how to solve it?
#!/usr/bin/perl use Tk; use strict; require Tk::NoteBook; require Tk::LabEntry; require Tk::Scrollbar; our $mw = MainWindow->new; $mw->geometry("800x1000"); my $canvas = $mw->Scrolled('Canvas', -scrollbars => "s")->pack(-fill = +> 'both', -expand => 1); $mw->withdraw(); $mw->Popup; # Create the NoteBook and add pages our $n = $canvas->NoteBook(-dynamicgeometry => 'true')->pack( -fill=>' +both', -expand=>1); $n->pack( -expand => "yes", -fill => "both", -side => "top" ); for ( 1 .. 20 ){ my $title = "mytab $_"; $_ = create_tab("$title"); } ### embed the notebook widget into the canvas my $nb_in_canvas = $canvas->createWindow( 0, 0, -window => $n, -anchor + => 'nw' ); $canvas->update; ### the whole notebook is larger than what can be initially displayed ### so we'll have to sroll it later on in the program $canvas->configure( -scrollregion => [0,0,$n->reqwidth,$n->reqheight]) +; sub create_tab { my $tabname = shift; my $tn = $n->add($tabname, -label => $tabname, -underline => 0); my $t = $tn->Scrolled("Text", -scrollbars => "e", -wrap => 'none') +->pack(-expand => 1, -fill => 'both'); $t->tagConfigure ('bold', -font => [ -size => 0, -weight => 'bold' + ]); return $t; } MainLoop;
In reply to Perl Tk Notebook not filling main window height by madhusudhan_s
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |