-
-
14 Feb 2021 12:53:44 UTC
- Distribution: Tk
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (141)
- Testers (1441 / 15 / 0)
- Kwalitee
Bus factor: 2- % Coverage
- License: unrestricted
- Activity
24 month- Tools
- Download (6.7MB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- nick@ing-simmons.net (Nick Ing-Simmons)
- Dependencies
- Encode
- Test::More
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
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
Perl/Tk applications (which have windows associated with them) create one or more MainWindows which act as the containers and parents of the other widgets.
Tk::MainWindow is a special kind of Toplevel widget. It is the root of a widget tree. Therefore
$mw->Parent
returnsundef
.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 numbern
is set to get a unique value.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
). Various resources (bindings, fonts, images, colors) are maintained or cached for each MainWindow, so each MainWindow consumes more resources than a Toplevel. However multiple MainWindows can make sense when the user can destroy them independently.METHODS
You can apply all methods that a Toplevel widget accepts.
The method $w->MainWindow applied to any widget will return the MainWindow to which the widget belongs (the MainWindow belongs to itself).
MISSING
Documentation is incomplete. Here are some missing items that should be explained in more detail:
The new mechanism for MainWindows is slightly different to other widgets.
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
Module Install Instructions
To install Tk, copy and paste the appropriate command in to your terminal.
cpanm Tk
perl -MCPAN -e shell install Tk
For more information on module installation, please visit the detailed CPAN module installation guide.