Home > Archive > PerlTk > November 2004 > How to create a new TopLevel (or just a new MainWindow) that lives on after parent di
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to create a new TopLevel (or just a new MainWindow) that lives on after parent di
|
|
| bayxarea-usenet@yahoo.com 2004-11-20, 3:56 am |
| 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?
| |
| zentara 2004-11-20, 8:56 am |
| On 19 Nov 2004 22:53:43 -0800, bayxarea-usenet@yahoo.com wrote:
>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?
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://zentara.net/japh.html
| |
| Marc Dashevsky 2004-11-20, 8:56 am |
| In article <1100933623.952701.260670@z14g2000cwz.googlegroups.com>, bayxarea-
usenet@yahoo.com says...
> 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?
No.
--
Go to http://MarcDashevsky.com to send me e-mail.
|
|
|
|
|