in reply to Perl/Tk Non-user Interactivity

You can do this in a simple subroutine, you just have to call $MW->update() frequently, so that you Tk events will be processed.

Replies are listed 'Best First'.
Re: Re: Perl/Tk Non-user Interactivity
by Daimun (Novice) on Mar 20, 2001 at 18:41 UTC
    I saw the update method, but I just don't understand how to use it. I have not been able to find any examples.
      Suppose you read from that socket and do the processing in a sub.
      This sub is called somewhere in the main program, probably from a menu.
      You pass a reference to the MainWindow to the sub and inside the sub you call update(), like this:
      . . . my $menu = $menubar->Menubutton(qw/Name menu -tearoff 0 -text somethin +g -underline 0 -menuitems/ => [ [command => 'read socket', -command => [\&read_socket, $MW]], ] )->pack(-side => 'left'); . . . sub read_socket { my $MW = shift; while (some_condition) { do_something_with_socket; $MW->update(); } }