Thank you Ken for that solution. It works!!

Now i added new subroutines to create tabs and add certain things on the tabs. when this program is run i notice that the tab content gets restricted vertically while horizontally it fits the main window width.

I realized that this is due to pack present in the subroutine create_tab. It so happens that i need the tab scrollbar and a main window scroll bar.

When i comment this pack my content and the tab and scrollbars vanish. How should i modify the program to have a vertical fit of the tab to main window height and contents on the tab seen.

Sorry if my question are too basic.

#!/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 2 pages, which are really # Frames with tabs. Given that, we create LabEntry # widgets and pack them as usual. 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 $_"; #$n->add( $_, -label => $title ); $_ = create_tab("$title"); create_tab_labentry($_, \$folder_name, "folder name: "); } ### 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); $t = $tn->Scrolled("Text", -scrollbars => "e", -wrap => 'none')->p +ack(-expand => 1, -fill => 'both'); $t->tagConfigure ('bold', -font => [ -size => 0, -weight => 'bold' + ]); return $t; } sub create_tab_labentry { my $tabname = shift; my $fc_address = shift; my $field_label = shift; $w = $tabname->Button(-text => $field_label, -relief => 'raised', +-width => 66); $tabname->windowCreate('end', -window => $w); $w = $tabname->Entry(-width => 35, -textvariable => $fc_address); $tabname->windowCreate('end', -window => $w); $tabname->insert('end', "\n"); } MainLoop;

In reply to Re^2: why is the size of notebooks area smaller than main window (Tk) by madhusudhan_s
in thread why is the size of notebooks area smaller than main window by madhusudhan_s

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.