Audar has asked for the wisdom of the Perl Monks concerning the following question:
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 -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; }
--------------------------------------------------------------- |Choose delimiter: | | | | | |Choose Filese Folder | | |------------- ------------- | | || || | | | || || | | Text Area | || || | | | || || | | | |------------- ------------- | | | | | | | | | Clear Mask Exit | | ---------------------------------------------------------------Thank you all!
my $pane_left_scr = $mw->Scrolled('Pane',-sticky => 'nsew')->pack( -s +ide => 'left',-fill => 'both', -expand => 1);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Tk - Frame packing issue
by kcott (Archbishop) on Feb 02, 2014 at 03:51 UTC | |
by Audar (Novice) on Feb 02, 2014 at 05:07 UTC | |
by Audar (Novice) on Feb 02, 2014 at 05:10 UTC | |
by Audar (Novice) on Feb 02, 2014 at 05:13 UTC | |
|
Re: Perl Tk - Frame packing issue (Tk::pack)
by Anonymous Monk on Feb 02, 2014 at 03:33 UTC |