madhusudhan_s has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I am trying to write a program which has many notebooks and i found a reference code from the web as below which is exactly what i want. When i make the main window size 870x1000 i notice that the area where the notebooks are present is smaller than the main window. How should i modify this code such that the notebooks are as big as the main window?#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::NoteBook; our $mw = MainWindow->new; $mw->geometry("870x1000"); my $canvas = $mw->Scrolled('Canvas',-bg=>'red')->pack; our $nb = $canvas->NoteBook; ### add 20 tabs to notebook for ( 1 .. 20 ){ my $title = "Untitled ($_)"; $nb->add( $_, -label => $title ); } ### embed the notebook widget into the canvas my $nb_in_canvas = $canvas->createWindow( 0,0,-window => $nb,-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,$nb->reqwidth,$nb->reqheight] +); MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: why is the size of notebooks area smaller than main window
by kcott (Archbishop) on May 22, 2017 at 05:28 UTC | |
by madhusudhan_s (Novice) on May 22, 2017 at 10:08 UTC | |
by zentara (Cardinal) on May 22, 2017 at 14:34 UTC | |
|
Re: why is the size of notebooks area smaller than main window (Tk)
by hippo (Archbishop) on May 22, 2017 at 07:42 UTC |