How to create a new TopLevel (or just a new MainWindow) that lives on after parent dies?

How to create a new TopLevel (or just a new MainWindow) that lives on after parent dies?

Post by bayxarea-u » Sun, 21 Nov 2004 15:53:43


I want to create a new window that will not die when the parent (the
main program) dies (exits, is destroyed, etc. I can't find this in the
docs or examples - or a search on this group.

Is this possible?
 
 
 

How to create a new TopLevel (or just a new MainWindow) that lives on after parent dies?

Post by zentar » Sun, 21 Nov 2004 21:23:13


You can create 2 mainwindows.
#!/usr/bin/perl -w
use Tk;

my $mw = MainWindow->new(-title=>"#1");

$mw->Button(-text=>"Make NEW Window",
-command=> sub { make_win(); })->pack;

$mw->Button(-text=>"Close Me",
-command=> sub { $mw->destroy })->pack;

MainLoop;

sub make_win
{
my $mw1 = MainWindow->new(-title=>"#2");

$mw1->Button(-text=>"CLOSE this window",
-command=> sub { close_win($mw1); }
)->pack();
}

sub close_win
{
my $thiswin = $_[0];
$thiswin->destroy;
}
__END__



--
I'm not really a human, but I play one on earth.
http://www.yqcomputer.com/

 
 
 

How to create a new TopLevel (or just a new MainWindow) that lives on after parent dies?

Post by Marc Dashe » Sun, 21 Nov 2004 21:27:28

In article < XXXX@XXXXX.COM >, bayxarea-
XXXX@XXXXX.COM says...

No.

--
Go to http://www.yqcomputer.com/ to send me e-mail.