Here is how I would do your program. I use numbers instead of files, but you should be able to switch it. Notice how the packing works. You can expand and contract, but only the bottom frame expands in both directions.

Also, instead of the tedious deleting and refilling the listboxes, I use the -listvariable option to show an array. Now, all you need to do is empty and refill the arrays, and the listbox will take care of itself.

#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = tkinit; my $topframe = $mw->Frame()->pack(-fill=>'x' ); my $mainframe = $mw->Frame()->pack(-expand=>1, -fill=>'both' ); my $exit_b = $topframe->Button(-text=>'Exit', -command=> sub{ exit } )->pack(-side => 'right', -padx=>20 +); my @array1=(); my $l1 = $mainframe->Scrolled('Listbox', -listvariable => \@array1, -scrollbars => 'ose') ->pack( -side => 'left', -expand=>1, -fill=>'both' ); my @array2=(); my $l2 = $mainframe->Scrolled('Listbox', -listvariable => \@array2, -scrollbars => 'ose') ->pack( -side => 'left', -expand=>1, -fill=>'both' ); my @array3=(); my $l3 = $mainframe->Scrolled('Listbox', -listvariable => \@array3, -scrollbars => 'ose') ->pack( -side => 'left', -expand=>1, -fill=>'both' ); &update; my $repeater = $mw->repeat(5000,\&update); MainLoop; sub update { foreach my $arr_ref (\@array1,\@array2,\@array3){ @$arr_ref = (); for (1..100){ push @$arr_ref, rand 10000; #sort @$arr_ref; #do a text sort on filenames $mw->update; } } }

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

In reply to Re^6: Problem with Tk::Repeat by zentara
in thread Problem with Tk::Repeat by padawan_linuxero

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.