How can I close a window in Perl/Tk?

Posted by guy ergas on Stack Overflow See other posts from Stack Overflow or by guy ergas
Published on 2010-05-27T12:27:29Z Indexed on 2010/05/27 16:21 UTC
Read the original article Hit count: 374

Filed under:
|

In my Perl/Tk script I have opened two windows. After a specific button click I want to close one of them. How can I do that? Here's what I have so far:

$main = new MainWindow;
$sidebar = $main->Frame(-relief => "raised", 
                        -borderwidth => 2)
                ->pack (-side=>"left" ,
                        -anchor => "nw", 
                        -fill   => "y");
$Button1 = $sidebar -> Button (-text=>"Open\nNetlist", 
                               -command=>  \&GUI_OPEN_NETLIST) 
                    ->pack(-fill=>"x");
MainLoop;

sub GUI_OPEN_NETLIST
{
    $component_dialog = new MainWindow;
    $Button = $component_dialog -> Button (-text=>"Open\nNetlist", 
                                           -command=>  **close new window**) 
                                ->pack(-fill=>"x"); 
    MainLoop;
}

© Stack Overflow or respective owner

Related posts about perl

Related posts about tk