Hello Monks, I am working on a gui application and currently have it up and running, except for the packing and resizing on the main window and widgets inside it. I have a Mainwindow and a Left and Right Frame -
use strict; use warnings; use Tk; use Tk::Table; use Tk::Pane; use Tk::DialogBox; use Tk::BrowseEntry; use Tk::ProgressBar; require Tk::LabFrame; ##Global Variables my $ffdir = ""; my $outfdir = ""; my $mmthd; my $delim=''; my $cols_maskmthd_tbl; my $mw; #my $xpm; my $cols_tbmasked_lbox; my $mask_but; my $txt; my $be; # Main Window $mw = new MainWindow; $mw->configure(-title=> "SomeTitle"); $mw->minsize(1020,590); $mw->resizable(1,1); #GUI Building Area ## Build left side frame my @leftfrm_options = ( '-relief','ridge','-borderwidth',1); # Main outer left frame my $pane_left_scr = $mw->Scrolled('Pane')->pack( -side => 'left',- +fill => 'both', -expand => 1); #my $frm_left = $pane_left_scr ->Frame(@leftfrm_options)->pack( -s +ide => 'left',-fill => 'both', -expand => 1, -anchor => 'nw' ); my $frm_left_sec1 = $pane_left_scr ->Frame(@leftfrm_options)->pack +( -side => 'top',-fill => 'both', -expand => 1, -anchor => 'nw' ); my $frm_left_sec1_left = $frm_left_sec1 ->Frame(@leftfrm_options)- +>pack( -side => 'left',-fill => 'both', -expand => 1, -anchor => 'nw' + ); my $frm_left_sec1_right = $frm_left_sec1 ->Frame(@leftfrm_options) +->pack( -side => 'right',-fill => 'both', -expand => 1, -anchor => 'n +w' ); my $frm_left_sec2 = $pane_left_scr ->Frame(@leftfrm_options)->pack +( -side => 'top',-fill => 'both', -expand => 1, -anchor => 'nw' ); my $frm_left_sec2_left = $frm_left_sec2 ->Frame(@leftfrm_options)- +>pack( -side => 'left',-fill => 'both', -expand => 1, -anchor => 'nw' + ); my $frm_left_sec2_right = $frm_left_sec2 ->Frame(@leftfrm_options) +->pack( -side => 'right',-fill => 'both', -expand => 1, -anchor => 'n +w' ); my $frm_left_sec3 = $pane_left_scr ->Frame(@leftfrm_options)->pack +( -side => 'top',-fill => 'both', -expand => 1, -anchor => 'nw' ); my $frm_left_sec3_left = $frm_left_sec3 ->Frame(@leftfrm_options)- +>pack( -side => 'left',-fill => 'both', -expand => 1, -anchor => 'nw' + ); my $frm_left_sec3_right = $frm_left_sec3 ->Frame(@leftfrm_options) +->pack( -side => 'right',-fill => 'both', -expand => 1, -anchor => 'n +w' ); my $frm_left_sec4 = $pane_left_scr ->Frame(@leftfrm_options)->pack +( -side => 'top',-fill => 'both', -expand => 1, -anchor => 'nw' ); my $frm_left_sec4_left = $frm_left_sec4 ->Frame(@leftfrm_options)- +>pack( -side => 'left',-fill => 'both', -expand => 1, -anchor => 'nw' + ); my $frm_left_sec4_right = $frm_left_sec4 ->Frame(@leftfrm_options) +->pack( -side => 'right',-fill => 'both', -expand => 1, -anchor => 'n +w' ); my $frm_left_sec5 = $pane_left_scr ->Frame(@leftfrm_options)->pack +( -side => 'top',-fill => 'both', -expand => 1, -anchor => 'nw' ); my $frm_left_sec6 = $pane_left_scr ->Frame(@leftfrm_options)->pack +( -side => 'top',-fill => 'both', -expand => 1, -anchor => 'center' ) +; my $frm_left_sec7 = $pane_left_scr ->Frame(@leftfrm_options)->pack +( -side => 'top',-fill => 'both', -expand => 1, -anchor => 'nw' ); my $frm_left_sec7_left = $frm_left_sec7 ->Frame(@leftfrm_options)- +>pack( -side => 'left',-fill => 'both', -expand => 1, -anchor => 'nw' + ); my $frm_left_sec7_center = $frm_left_sec7 ->Frame(@leftfrm_options +)->pack( -side => 'left',-fill => 'both', -expand => 1, -anchor => 'n +w' ); my $frm_left_sec7_right = $frm_left_sec7 ->Frame(@leftfrm_options) +->pack( -side => 'right',-fill => 'both', -expand => 1, -anchor => 'n +w' ); my $frm_left_sec8 = $pane_left_scr ->Frame(@leftfrm_options)->pack +( -side => 'top',-fill => 'both', -expand => 1, -anchor => 'nw' ); my $frm_left_sec8_left = $frm_left_sec8 ->Frame(@leftfrm_options)- +>pack( -side => 'left',-fill => 'both', -expand => 1, -anchor => 'nw' + ); my $frm_left_sec8_right = $frm_left_sec8 ->Frame(@leftfrm_options) +->pack( -side => 'right',-fill => 'both', -expand => 1, -anchor => 'n +w' ); ###Choose delimiter my $choose_delim_lab = $frm_left_sec1_left -> Label(-text=>"Enter +or choose a delimiter:",-width => 22,-anchor => 'nw') ->pack( -side => 'left',-anchor => 'nw',-fill => 'none'); # If user selects item from list manually, invoke do_search $be = $frm_left_sec1_left->BrowseEntry( -variable => \$delim, -browsecmd => \&set_delim ) ->pack( -side => 'right', -expand => 1, -anchor => 'nw',-fill => ' +none' ); #Choose ff my $choose_ff_but = $frm_left_sec2_left -> Button(-text=>" Choose + Files Folder ", -bg => 'yellow' ) ->pack( -side => 'top',-expand => 1, -anchor => 'nw' ); my $choose_ff_lab = $frm_left_sec2_right-> Label(-textvariable=>\$ +ffdir, -bg => 'yellow') ->pack( -side => 'top',-fill=>'x', -expand => 1, -anchor => 'nw' +); ##Choose out folder my $choose_outf_but = $frm_left_sec3_left -> Button(-text=>"Choose + Output Folder", -bg => 'yellow', -command => sub { choose_outf_dir(\ +$outfdir) }) ->pack( -side => 'top',-expand => 1, -anchor => 'nw' ); my $choose_outf_lab = $frm_left_sec3_right -> Label(-textvariable= +>\$outfdir, -bg => 'yellow +') ->pack( -side => 'top',-fill=>'x',-expand => 1, -anchor => 'nw' ); ##Cols to be masked my $choose_cm_labfra = $frm_left_sec4_left->LabFrame( -borderwidth => '2', -label => "Columns To +Mask", -labelside => "acrosst +op", -relief => 'groove') ->pack( -side => 'top',-fill => 'x',-expand => 1, -anchor => 'nw' +); $cols_tbmasked_lbox = $choose_cm_labfra->Scrolled("Listbox", -scro +llbars => "se", -selectmode => "mu +ltiple", -width => 30, -hei +ght=> 10) ->pack( -side => 'top',-fill => 'x',-expand => 1, -anchor => 'nw' +); my $up_down_lab = $frm_left_sec5-> Label(-text=>" ".chr(8593).chr( +8595)." ", -font => 'big') ->pack( -side => 'top',-expand => 0, -anchor => 'center' ); #Choose Masking method my $mask_method_labfra = $frm_left_sec4_right->LabFrame( -borderwidth => '2', -label => "Choose Mask +ing Method", -labelside => "acrosst +op", -relief => 'groove') ->pack( -side => 'top',-fill => 'x',-expand => 1, -anchor => 'nw' + ); my $hash_rdb = $mask_method_labfra -> Radiobutton(-text=>"Hash + ", -value=>"hashed", + -variable=>\$mmthd, -command=>sub {col +s_maskmthd_pairs($mmthd)}) ->pack( -side => 'top',-expand => 1, -anchor => 'w', -pady => 15 ) +; my $scramble_rdb = $mask_method_labfra -> Radiobutton(-text=>"Scra +mble ", -value=>"scram +bled", -variable=>\$mmthd, -command=>sub +{cols_maskmthd_pairs($mmthd)}) ->pack( -side => 'top',-expand => 1, -anchor => 'w', -pady => 20 ) +; my $static_rdb = $mask_method_labfra -> Radiobutton(-text=>"Static + Value ", -value=>"static", + -variable=>\$mmthd, -command=>sub {col +s_maskmthd_pairs($mmthd)}) ->pack( -side => 'top',-expand => 1, -anchor => 'w', -pady => 14 ) +; # allocate a table to the frame $cols_maskmthd_tbl = $frm_left_sec6->Table( -columns => 2, -rows => 7, -fixedrows => 1, -scrollbars => 'e', -relief => 'raised') ->pack( -side => 'top',-fill => 'x',-expand => 1, -anchor => 'cent +er' ); ## Clear ALL my $clrall_but = $frm_left_sec7_left -> Button(-text=>" Clear All + ",-activeforeground => 'red', -command => sub {clear_all()}) ->pack( -side => 'top',-expand => 1, -anchor => 'center' ); ##Execute mask $mask_but = $frm_left_sec7_center-> Button(-text=>" Mask! ", -co +mmand => sub {init_mask()}) ->pack( -side => 'top',-expand => 1, -anchor => 'center' ); #Exit my $exit_but = $frm_left_sec7_right -> Button(-text=>" Exit ",-a +ctiveforeground => 'red', -command => sub {exit_final()}) ->pack( -side => 'top',-expand => 1, -anchor => 'center' ); #Text Area my $pane_right_scr = $mw->Scrolled('Pane' )->pack( -side => 'right +',-fill => 'both', -expand => 1); $txt = $pane_right_scr ->Text()->pack( -side => 'top',-fill => 'bo +th', -expand => 1 ); MainLoop; sub exit_final { exit 0; }
Thank you for the helpful tips kcott, I have now modified my question to be a working example. I also used Tk::Pane as you suggested. The same issue still exists (maybe cause of -fill => 'both', -expand => 1 , as you suggest), but I dont know how else to have the left and right panes, fill the entire left and right halvres respectively and ALSO expand when the application window is expanded. What am I doing wrong? This is what I'm looking for -

---------------------------------------------------------------
|Choose delimiter:           |                                |
|                            |                                |
|Choose Filese Folder        |                                |
|------------- ------------- |                                |
||           ||            | |                                |
||           ||            | |             Text Area          |
||           ||            | |                                |
||           ||            | |                                |
|------------- ------------- |                                |
|                   	     |                                |
|                   	     |                                |
| Clear       Mask      Exit |                                |
---------------------------------------------------------------
Thank you all!
UPDATE :
I was able to fix the issue with - -sticky => 'nsew'
my $pane_left_scr = $mw->Scrolled('Pane',-sticky => 'nsew')->pack( -s +ide => 'left',-fill => 'both', -expand => 1);

In reply to Perl Tk - Frame packing issue by Audar

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.