You didn't provide a Short, Self-Contained, Correct Example so I tossed a bunch of guesses into a pot and stirred...

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11118943 use warnings; use Tk; use Tk::DialogBox; use Time::HiRes qw( sleep ); { # start package package Tk::AltDialogBox; use base qw( Tk::DialogBox ); Tk::Widget->Construct('AltDialogBox'); sub Wait { my $cw = shift; $cw->Callback(-showcommand => $cw); $cw->waitVariable(\$cw->{'selected_button'}); $cw->grabRelease if Tk::Exists($cw); $cw->Callback(-command => $cw->{'selected_button'}); # swapped with +next line $cw->withdraw if Tk::Exists($cw); } } # end package my $message = ' '; my $mw = MainWindow->new; $mw->geometry( '200x200+1000+300' ); my $lb; my $d; $d = $mw->AltDialogBox( -buttons => ['OK', 'Cancel'], -command => sub { my $value = $lb->get($lb->curselection // 0); $message = "working on $_ ...\n", $d->update, sleep 0.3 for 1 .. 1 +0; print "exited by @_ with $value\n"; }, -showcommand => sub { $lb->selectionClear(0, 'end'); $lb->selectionSet(0); $message = ' '; }, ); $lb = $d->add(Listbox => -height => 10)->pack; $d->add(Label => -textvariable => \$message, -height => 2)->pack; $lb->insert('end' => 1 .. 5); $mw->Button(-text => 'See Dialog', -command => sub { $d->Show }, )->pack; MainLoop;

In reply to Re: DialogBox that persists awhile by tybalt89
in thread DialogBox that persists awhile by DcmbrAgnt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.