Here is my solution. The main differences are:
use strict; use warnings; use Tk; use Tk::HList; use Tk::ItemStyle; use Tk::BrowseEntry; use Tk::FontDialog; my $mw = MainWindow->new; $mw->title("View"); $mw->minsize(560, 180); my ($user, $sec, $selectfile) = ('user', 30, 'file'); my %url; my $userframe = $mw->Frame()->pack( -side => 'top', -fill => 'both', -expand => +0 ); my $hlistframe = $mw->Frame()->pack( -side => 'top', -fill => 'both', -expand => +1 ); my $bottomframe = $mw->Frame()->pack( -fill => 'x', -expand => 0 ); my $menubutton = $userframe->Menubutton( -text => "Font", )->pack( -side => 'left +' ); $menubutton->command( -label => "Change", -command => sub { my $font = $mw->FontDialog->Show; $mw->RefontTree( -font => $font ) if defined $font; } ); $userframe->Label( -text => "USER: $user" ) ->pack( -side => 'left', -anchor => 'w', -padx => 10 ); $userframe->Label( -text => "Set time(sec)" ) ->pack( -side => 'left', -anchor => 'w', -padx => 10 ); my $frequency = $userframe->Entry( -width => 5, -textvariable => \$sec + ) ->pack( -side => 'left', -anchor => 'nw', -padx => 10 ); $userframe->Label( -text => "Select File" ) ->pack( -side => 'left', -anchor => 'w', -padx => 10 ); $userframe->BrowseEntry( -state => 'normal', -choices => [ keys %url ], -variable => \$selectfile, -browsecmd => \&read_file, )->pack( -side => 'left', -anchor => 'w' ); my $hl = $hlistframe->Scrolled( 'HList', -scrollbars => 'ose', -columns => 7, -header => 1, -height => -1, -command => sub { print "AAA\n"; }, )->pack( -fill => 'both', -expand => 1 ); my $label1 = $hl->Label( -text => "Tool", -anchor => 'w' ); $hl->headerCreate( 0, -itemtype => 'window', -widget => $label1 ); my $label2 = $hl->Label( -text => "Vendor", -anchor => 'w' ); $hl->headerCreate( 1, -itemtype => 'window', -widget => $label2 ); my $label3 = $hl->Label( -text => "Available", -anchor => 'w' ); $hl->headerCreate( 2, -itemtype => 'window', -widget => $label3 ); my $label4 = $hl->Label( -text => "num.", -anchor => 'w' ); $hl->headerCreate( 3, -itemtype => 'window', -widget => $label4 ); my $label5 = $hl->Label( -text => "usage%", -anchor => 'w' ); $hl->headerCreate( 4, -itemtype => 'window', -widget => $label5 ); my $label6 = $hl->Label( -text => "user", -anchor => 'w' ); $hl->headerCreate( 5, -itemtype => 'window', -widget => $label6 ); my $label7 = $hl->Label( -text => "user%", -anchor => 'w' ); $hl->headerCreate( 6, -itemtype => 'window', -widget => $label7 ); $bottomframe->Button( -text => "Display File", -command => \&dumpOnTer +minal ) ->pack( -side => 'right', -anchor => 'ne', -fill => 'x' ); MainLoop;

This answers also to your other question regarding the font and window dimensions change.

Update: Changed the intro paragraph. The dimension of the window doesn't always change, only when it accommodates to bigger contents.

Update2: Updated the update :-)


In reply to Re: perl tk frame packing question by stefbv
in thread perl tk frame packing question by ghosh123

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.