Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
UPDATE: Fixed alignment problem

I never mess with grid, but here is a way that I would do it. Make everything in a hash, so you can easily retreive values, by specifying page, and frame. (I may have made some logic errors in the frame setup...and the boxes can be aligned with padding your text with spaces). I'm in a test,test,test, but it appears to work.

#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::NoteBook; require Tk::Pane; use Tk::LabEntry; my $mw = MainWindow->new(); $mw->geometry( "600x500" ); my $book = $mw->NoteBook()->pack( -fill=>'both', -expand=>1 ); my %hash; my @tabs = (1..5); foreach my $tab(@tabs){ $hash{$tab}{'frame'} = $book->add( "Sheet $tab", -label=>"program $tab +"); #$hash{$tab}{'frame'} = $book->add( "Sheet $tab", -label=>"program $ta +b"); } #make a Scolled Pane in every tab, with 2 frames for columns foreach my $tab(@tabs){ $hash{$tab}{'spane'}= $hash{$tab}{'frame'}->Scrolled('Pane',-bg=>'whi +te') ->pack(-expand=>1,-fill=>'both'); #now pack 2 side by side frames in the scrolled Pane $hash{$tab}{'f1'}= $hash{$tab}{'spane'}->Frame(-bg=>'hotpink', -padx +=>15) ->pack(-side=>'left',-expand=>1,-fill=>'both',-padx=>15); $hash{$tab}{'f2'}= $hash{$tab}{'spane'}->Frame(-bg=>'lightseagreen',- +padx=>15) ->pack(-side=>'right',-expand=>1,-fill=>'both'); } #now make columns foreach my $tab(@tabs){ foreach my $fr('f1','f2'){ #make frames for each pair $hash{$tab}{$fr}{'subframel'} = $hash{$tab}{$fr}->Frame() ->pack(-side=>'left',-expand=>1,-fill=>'both'); $hash{$tab}{$fr}{'subframer'} = $hash{$tab}{$fr}->Frame() ->pack(-side=>'right',-expand=>1,-fill=>'both'); } } #now fill columns foreach my $val qw(IN_DIR IN_LIST OUT_TYPE BYTESWAP OUTPUTAUX ){ foreach my $tab(@tabs){ foreach my $fr('f1','f2'){ $hash{$tab}{$fr}{'subframel'}{'labentry'} = $hash{$tab}{$fr}{'subframel'}->LabEntry(-label => "$val="); $hash{$tab}{$fr}{'subframel'}{$val}{'val'} = "$val-$tab-$fr"; $hash{$tab}{$fr}{'subframel'}{'labentry'}->Subwidget('entry')-> configure(-background=>'yellow', -width => 25, -textvariable => \$hash{$tab}{$fr}{'subframel'}{$val}{'val'} +); $hash{$tab}{$fr}{'subframel'}{'labentry'}->configure( -labelPack=>[-side=>'left',-anchor=>'w'], -width => 20, ); $hash{$tab}{$fr}{'subframel'}{'labentry'}->pack(-anchor=>'e'); + } } } MainLoop; __END__

I'm not really a human, but I play one on earth Remember How Lucky You Are

In reply to Re: Tk Notebook tab columns by zentara
in thread Tk Notebook tab columns by honyok

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (2)
    As of 2021-03-08 00:56 GMT
    Find Nodes?
      Voting Booth?
      My favorite kind of desktop background is:

      Results (123 votes). Check out past polls.