views:

49

answers:

1

I want to hide the mainwindow for a certain amount of time then show it again. Example:

use Tk;

my $mw = new MainWindow;
my $lblMsg = $mw -> Label(-text=>"blabla")-> grid();
my $btnPostpone = $mw -> Button(-text=>"Postpone for (min): ",
              -command =>\&postpone)-> grid();

MainLoop;

sub postpone{
$mw-> withdraw();
sleep(1);
$mw->deiconify();
$mw->raise();
sleep(1);
exit;
}

With the above code the main window will reappear but none of the widgets are displayed. What do I have to do so everything will look exactly the way it did before it was hidden?

Any hints appreciated.

A: 

You need to call $mw->update(); after you raise() the main window.

This link explains why in a bit of detail.

clebio
Thanks a lot. The link made things clear.