# Including this to show where the widgets are created. sub gui { # ... $tk{top} = MainWindow->new(); $tk{nb} = $tk{top}->NoteBook()->pack( -fill=>'both', -expand=>1 ); $tk{p2} = $tk{nb}->add( 'page2', -label => 'Status' ); ( $tk{stat} ) = $tk{p2}->Scrolled( 'ROText', -wrap => 'none', -scrollbars => 'se' ); #... } #The yviewMoveto() and update() calls update the notebook page. sub myprint { my( $msg ) = @_; $tk{stat}->insert( 'end', $msg ); $tk{stat}->yviewMoveto( 1 ); $tk{stat}->update(); } # Just showing how myprint() gets called sub start_pinging_button_was_clicked { # ... $tk{stat}->Busy( -recurse => 1 ); foreach my $host ( @data ) { my $result = myping($host); myprint( $result ); $tk{stat}->Unbusy(); # ... }