in reply to Unable to completely destroy a Dialog in Perl Tk

$prompt_warning->destroy if ($warnings eq "we're ok now!"; is premature and doesn't work. It works better by calling "after" right before "show". Here's a dialog that disappears after 10000 milliseconds:
#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::Dialog; my $mw = MainWindow->new; my $warnings = ""; my $prompt_warning = $mw->Dialog( -title => 'Warnings:', -text => 'danger', -bitmap => 'warning', -default_button => 'OK' ); my $answer = readmap(0); my %question; for ( my $i = 1 ; $i < 256 ; $i = $i * 2 ) { unless ( ( $answer & $i ) == 0 ) { $warnings = $question{$answer}; $prompt_warning->after( 10000, sub { $prompt_warning->Exit; } ); $prompt_warning->Show(); } } sub readmap { print "What is readmap()?\n"; }

Replies are listed 'Best First'.
Re^2: Unable to completely destroy a Dialog in Perl Tk
by pashanoid (Scribe) on Aug 11, 2011 at 09:45 UTC

    Works like a charm! Thank you!

    readmap() is a subroutine that talkes to a smart invertor and gets all kinds of parameters from it, here's a screenshot: http://www.pashanoid.ru/warning_1.png