user401304 user401304 - 1 year ago 111
Perl Question

Hide window in Perl/Tk and show again incl. all widgets

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

use Tk;

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


sub postpone{
$mw-> withdraw();

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.

Answer Source

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

The Tcl Tk Wiki explains why in a bit of detail.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download