marauder has asked for the wisdom of the Perl Monks concerning the following question:

does anyone know how i can easily open/close a tk window? i am trying to have a window saying "please wait" then later on in my script close this window when I want. here's the code from specPerl, this displays the window but what command do I issue to close mainwindow?;

#Sample SpecTcl main program for testing GUI use Tk; require Tk::Menu; my($top) = MainWindow->new(); $top->title("compressing test"); # interface generated by SpecTcl (Perl enabled) version 1.1 # from compressing.ui # For use with Tk402.002, using the grid geometry manager sub compressing_ui { my($root) = @_; # widget creation my($label_1) = $root->Label ( -text => 'please wait...', ); # Geometry management $label_1->grid( -in => $root, -column => '1', -row => '1' ); # Resize behavior management # container $root (rows) $root->gridRowconfigure(1, -weight => 0, -minsize => 30); # container $root (columns) $root->gridColumnconfigure(1, -weight => 0, -minsize => 30); # additional interface code # end additional interface code } compressing_ui $top; Tk::MainLoop; 1;#

Replies are listed 'Best First'.
Re: close a tk window?
by Chmrr (Vicar) on Jan 13, 2002 at 03:09 UTC

    You want to put $top->destroy; into a callback somewhere; this will cause the window to close.

    As an aside, you need to put <code> tags around code that you post in the Monastery.

    perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'