Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, I have a script that query through database and give results. what i want is that while it search the main window (mw) will show that it searching (write search...) it can be inside status bar or a label... any idea how to do it?

Replies are listed 'Best First'.
Re: Perl TK Status bar or just label
by stefbv (Priest) on May 30, 2011 at 10:30 UTC
    The SYNOPSIS section for Tk::StatusBar has a very nice example, with a progressbar and labels.
Re: Perl TK Status bar or just label
by Anonymous Monk on May 30, 2011 at 10:06 UTC
Re: Perl TK Status bar or just label
by zentara (Cardinal) on May 30, 2011 at 17:01 UTC
    Here is a simple example: Happy Memorial Day!
    #!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new; $mw->geometry('300x200'); my $timer; # global for timer my @color = qw/red black/; my $bits = pack("b16"x8, "1111111111111111", ".11111111111111.", "..111111111111..", "...1111111111...", "....11111111....", ".....11111......", "......111.......", ".......1........",); $mw->DefineBitmap('indicator' => 16,8, $bits); my $label = $mw->Label( -bitmap=>'indicator', -bg=>'black', -fg=>'red')->pack; my $button = $mw->Button(-text => 'Start', -command => \&change_label)->pack(); MainLoop; sub change_label { if ($button->cget('-text') eq "Start"){ $button->configure(-text => 'Stop'); $timer = $mw->repeat(100, sub{$label->configure(-fg=>$color[0]); @color=reverse(@color); }); } else { $button->configure(-text => 'Start'); $timer->cancel; } }

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh