Here's an example that uses a Toplevel to fake a messagebox, and ->after for the timing.
Fill in the toplevel with whatever message you want. I sort of tried to simulate what you
say you want to do.
If the scraper is a long running process, take a look at Tk::IO which would run
it in a sub-process and just fetch the results.
#!/usr/bin/perl
use strict; # https://perlmonks.org/?node_id=11126974
use warnings;
use Tk;
my $fakebox;
my $oldstatus = '';
my $vertical = 0;
my $mw = MainWindow->new;
$mw->geometry( '+500+600' );
$mw->Button( -text => 'Exit', -command => sub {$mw->destroy},
-font => 'courierbold 24')->pack;
$mw->after( 1, \&checker );
MainLoop;
sub checker
{
my $new = localtime(); # replace localtime with your scraper results
if( $new ne $oldstatus )
{
$fakebox and $fakebox->destroy;
$fakebox = $mw->Toplevel();
$fakebox->title( 'Message Box' ); # really fake it :)
$fakebox->geometry( '+300+' . (300, 400)[$vertical ^= 1] );
$fakebox->Label( -text => ' Notice ', -font => 'times 24',
-fg => 'white', -bg => 'red3' )->pack;
$fakebox->Label( -text => $new, -font => 'times 24' )->pack;
$oldstatus = $new;
}
$mw->after( 3000, \&checker );
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|