lakshmananindia has asked for the wisdom of the Perl Monks concerning the following question:
I am in the process of writing a program which alerts the user when a Mail is received by an IMAP server. I alert the user by displaying a Dialog box.
But what happens is, the program is getting blocked until, the user presses the ok buttoon
But I want to continue my program, even if the user didn't give input. I searched in perlmonks and I got posts regarding to use the splash screen
I've tried the following sample program
#!/usr/bin/perl -w use strict; use Tk; my $mw = tkinit; $mw->withdraw(); my $i=0; my $k=0; while (1) { my $notification = $mw->Toplevel(); $notification->geometry("+$i+$k"); $i+=10; $k+=5; $notification->protocol('WM_DELETE_WINDOW' => sub { $notificat +ion->withdraw; }); $notification->Label( -text => 'Your message displayed here.', -height => 5 )->pack; $notification->withdraw; $notification->deiconify; $notification->raise; $notification->update(); $mw->after(5000); }
The code works. It display a new window in the given geomentry
Now If I click the close button in any one of the splash screen, I want to close only that splash screen
Can someone suggest how to do that??
I also wanted to know, is there any ways to make the dialog box to non-blocking??
The great pleasure in my life is doing what people say you cannot do.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Non blocking a Dialog box in Perl Tk
by thundergnat (Deacon) on Apr 23, 2010 at 16:35 UTC |