Try something like this. Making the lists scroll and a proper way to terminate the worker thread(s) is something gor you to read up on.

use strict; use Tk; use Threads; use Thread::Queue; sub create_tk_window { my $mw=MainWindow->new ( -background=>'#dedede', -foreground=>'yellow', -title=>"FingerLick" ); $mw->geometry("802x618"); $mw->minsize(802,618); $mw->maxsize(802,618); my $sent_recvd_listbox=$mw->Listbox ( -height=>10, -width=>60, -background=>'black', -foreground=>'yellow' )->pack(-side=>'bottom',-anchor=>'s',-pady=>2); my $server_list_listbox=$mw->Scrolled ( "Listbox", -height=>20, -width=>60, -background=>'white', -foreground=>'black', -scrollbars=>'se', )->pack(); return( $mw, $sent_recvd_listbox, $server_list_listbox ); } sub update_thread { my( $Qservers, $Qxmit ) = @_; while(1) { $Qservers->enqueue( "Server" . int rand 1000 ) if rand() < .1; $Qxmit->enqueue( "Sent: la la la " . int rand 1000 ) if rand() + < .1; $Qxmit->enqueue( "Recv: do be do be do " . int rand 1000 ) if +rand() < .1; select undef, undef, undef, 0.1; } } my $Qservers = new Thread::Queue; my $Qxmit = new Thread::Queue; my( $mw, $srl, $slb ) = create_tk_window(); sub updateScreen { $slb->insert( 'end', $Qservers->dequeue ) if $Qservers->pending; + $srl->insert( 'end', $Qxmit->dequeue ) if $Qxmit->pending; } threads->new( \&update_thread, $Qservers, $Qxmit )->detach; $mw->repeat( 100, \&updateScreen ); $mw->MainLoop;

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

In reply to Re: Sharing Tk-module objects in threads by BrowserUk
in thread Sharing Tk-module objects in threads by kabeldag

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.