NAME
Tk::MainWindow - Root widget of a widget tree
SYNOPSIS
use Tk;
my $mw = MainWindow->new( ... options ... );
my $this = $mw->ThisWidget -> pack ;
my $that = $mw->ThatWidget;
...
MainLoop;
DESCRIPTION
Tk::MainWindow is a special kind of Toplevel widget. It's the root of a widget tree. Therefore $mw->Parent
returns undef
.
Unlike the standard Tcl/Tk's wish, perl/Tk allows you to create several MainWindows. When the last MainWindow is destroyed the Tk eventloop exits (the eventloop is entered with the call of MainLoop
).
The default title of a MainWindow is the basename of the script (actually the Class name used for options lookup, i.e. with basename with inital caps) or 'Ptk' as the fallback value. If more than one MainWindow is created or several instances of the script are running at the same time the string " #n"
is appended where the number n
is unset to get a unique value.
METHODS
You can apply all methods that a Tk::Toplevel accepts.
To access the MainWindow one can use for all widget the method $w-
Mainwindow()> that returns a reference to the MainWindow. the widget belongs to (the MainWindow belongs to itself).
MISSING
Documentation is incomplete. Category: better than nothing. Here are some of missing items that should be explained is more details:
There no explanation about what resources are bound to a MainWindow (e.g., ClassInit done per MainWindow)
Passing of command line options to override or augment arguments of the
new
method (see Tk::CmdLine).
SEE ALSO
Tk::Toplevel, Tk::CmdLine