but i'm curious to know where you found this information or if just comes from your tries.
Just from tries, its simpler than reading the source
How can i retrieve more infos about tkinit anyway? in the Tk source I just see: It is just a shortcut to call for a MainWindow creation?
Its one of those things monkey see, and yes its just a shortcut , its defined inside Tk.pm, just like MainLoop
sub tkinit { return MainWindow->new(@_) } sub MainLoop { unless ($inMainLoop) { local $inMainLoop = 1; while (Tk::MainWindow->Count) { DoOneEvent(0); } } }
Anyway I prefere the pryrt's solution ...
Yes, parents kill children, but you don't gotta let the user kill the window so you have to recreate it, just hide/show
#!/usr/bin/perl -- use strict; use warnings; use Tk; my $mw = MakeMain(); my $phwin = MakePhwin( $mw ); $mw->focus; $mw->WidgetDump; MainLoop; sub MakePhwin { my( $mw ) = @_; my $phwin = $mw->Toplevel; $phwin->protocol( 'WM_DELETE_WINDOW', [sub{shift->withdraw}, $phwi +n], ); $phwin->Label(-text => "Close me hit the little x" )->pack; return $phwin; } sub MakeMain { my $mw = tkinit(@_); $mw->Button( -text => "Restore phwin", -command => sub { $_->deiconify for grep $_->isa('Tk::Toplevel'), $Tk::widget->toplevel->children; }, )->pack; $mw->update; return $mw; }
In reply to Re^3: Tk MainWindow and another TopLevel spawn order (taskbar order LIFO win32)
by Anonymous Monk
in thread Tk MainWindow and another TopLevel spawn order
by Discipulus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |