Pausing Main Program whilst in TopLevel



Hi all,
I have a Main Window which is a Read Only Text editor that updates me
with what the rest of the program is doing. Halfway through my program
I need to plot some graphs and so I call a subroutine and use a
TopLevel Canvas with a continue button.
My problem is that the main program continues regardless of whether or
not I press the Ok button on the TopLevel - I have tried putting the
graphing part in the main program too but that doesn't seem to work
either.I have vaguely outlined the main parts of the program below.
Essentially, I don't want "This is the second update" to appear until I
have pressed 'OK'
Please help!!!
Laura

$main=MainWindow->new;
$text=$main->Text(-height=>200)->pack();
$text->insert(1.0,'This is the first update');
$text->update();

&new_routine($main);
$text->insert(1.0,'This is the second update');
$text->update();
MainLoop;

sub new_routine{
$tk=$main->TopLevel;
$canvas=$tk->Canvas()->pack();
##Do the graph stuff
$tk->Button(-text=>'OK',-command=>sub{$tk->destroy;});
}

.