Jim Hansen wrote:
> To the TK wizs: I'm trying to set up a simple Perl/TK window that
> will display a status message as a background process does it's
> thing. Although this works, it requires user intervention to close
> the window so the program can carry on. This is probably a big
> question, but how can I add this to a program so this displays while
> the pther program does its thing, then disappears when the other is
> ready to display its output?
>
> Thanks
>
> use strict;
>
> use TK;
>
> my $msg = shift;
>
> my $mw = MainWindow->new;
>
> $mw->configure(-background=>'cyan');
>
> $mw->title("Status");
> $mw->Label(-text => "Aquiring Server Information......", -width =>
> 50, -height => 15,
> -font => "{Fixedsys} 12 {normal}")->pack;
> $mw->Button(-text => 'OK', -font => "{Fixedsys} 12 {normal}",
> -command => sub {$mw->destroy})->pack;
>
> $mw->focusForce;
>
> $mw->geometry('+250+100');
>
> MainLoop;
You could add an event handler and execute it periodically to check the
status of the other job. Not sure how your other job will communicate
the status, but that should work. The easier solution is to combine the
two tasks into one task so it would know the status at all times (if that's
possible in your case).
Replace the Mainloop line with:
my $tid = $mw->repeat(1000, \&timer_callback);
MainLoop;
sub timer_callback {
print "Checking status\n"; # for debug - replace with status checking code
}
If at some point you want to stop the timer:
$mw->afterCancel($tid);
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs