1overview(3)           User Contributed Perl Documentation          overview(3)
2
3
4

NAME

6       Tk::overview - An overview of an Object Oriented Tk8 extension for
7       perl5
8

SYNOPSIS

10       "use Tk;"
11
12       "$main = MainWindow->new();"
13
14       "$widget = $main->Widget(...);"
15
16       "$widget->pack(...);"
17
18       ...
19
20       "MainLoop;"
21

DESCRIPTION

23       In writing the perl Tk extension, the goals were to provide a complete
24       interface to the latest production version of John Ousterhout's Tk,
25       while providing an Object Oriented interface to perl code.
26

CONTENTS

28       The package is composed of three loosely connected parts:
29
30       pTk - Converted Tk source
31           The pTk sub-directory is a copy of the C code of Tk8.x, modified to
32           allow use by languages other than the original Tcl.  (The pTk can
33           be read as 'perl' Tk or 'portable' Tk, depending on your
34           sensibilities.)
35
36       Tk to Perl 'Glue'
37           The top level directory provides Tk.xs and tkGlue.c which provide
38           the perl-callable interfaces to pTk
39
40       Perl code for 'Widget' Classes
41           The Tk sub-directory contains the various perl modules that
42           comprise the "Classes" that are visible to Tk applications.
43
44           The "major" widgets such as Tk::Text are actually in separate
45           directories at the top level (e.g. Text/* for Tk::Text) and are
46           dynamically loaded as needed on platforms which support perl5's
47           DynaLoader.
48

CLASS HIERARCHY

50       package Tk; - the 'base class'
51           All the "command names" documented in Tcl/Tk are made to look like
52           perl sub's and reside in the Tk package. Their names are all lower
53           case.  Typically there are very few commands at this level which
54           are called directly by applications.
55
56       package Tk::Widget; - the 'Widget class'
57           There are no actual objects of the Tk::Widget class; however all
58           the various Tk window "widgets" inherit from it, and it in turn
59           inherits all the core Tk functions from Tk.
60
61           Tk::Widget provides various functions and interfaces which are
62           common to all Widgets.
63
64           A widget is represented to perl as a blessed reference to a hash.
65           There are some members of the hash which are private to Tk and its
66           tkGlue code.  Keys starting with '.' and of the form
67           /^_[A-Z][A-Za-z_]+_$/ (i.e. starting and ending in _ and with
68           first char after _ being upper case) should be considered reserved
69           to Tk.
70
71       Tk::Button, Tk::Entry, Tk::Text ...
72           There is one class for each of the "Tk" widget item types.  Some of
73           them like Tk::Frame do very little indeed, and really only exist so
74           that they can be derived from or so that focus or menu traversal
75           can discover the "kind" of window being processed.
76
77           Other classes, Tk::Text for example, provide a lot of methods used
78           with Tk's "bind" to provide a rich keyboard/mouse interface to the
79           widgets' data.
80
81           These widget classes also include conversions of the Tcl code for
82           event bindings, keyboard focus traversal, menu bars, and menu
83           keyboard traversal. All the Tcl functions have been converted, but
84           the names have changed (systematically) and they have been split up
85           between the various classes in what I hope is an appropriate
86           manner.  Name changes are normally: dropping initial tk_ as the Tk-
87           ness is implicit in the Tk:: prefix, and similarly dropping say
88           Menu from the name if it has been moved the Tk::Menu class.  Thus
89           'proc tkMenuNextEntry' becomes 'sub NextEntry' in the Tk::Menu
90           package.
91
92       Tk::Image
93           This does for Tk8.x's "images" what Tk::Widget does for widgets.
94           Images are new to Tk8.x and the class structure is not mature
95           either.
96
97           There are three sub-classes Tk::Bitmap, Tk::Pixmap and Tk::Photo.
98
99           It is possible to create dynamic or auto-loaded image types
100           inherited from Tk::Image for other image types or photo formats
101           (e.g. support for TIFF format).
102
103       Composite Widgets
104           A composite is some kind of 'frame' with subwidgets which give it
105           useful behaviour.  Tk::Dialog is an example of a composite widget
106           classes built from the basic Tk ones.  It is intended that user
107           code should not need to be aware that a particular class is a
108           composite, and create and configure such widgets in the same manner
109           as any other kind. The configure mechanism and the methods of the
110           class manipulate the subwidgets as required.
111
112           Composite widgets are implemented via Tk::Frame and multiple
113           inheritance.  The two 'frame' base classes Tk::Frame and
114           Tk::Toplevel include the additional class Tk::Derived in their
115           inheritance. Tk::Derived provides methods to allow additional
116           configure options to be defined for a widget.
117
118           A Composite widget is typically defined as derived from Tk::Frame
119           or Tk::Toplevel (e.g. Tk::Dialog).
120
121
122
123perl v5.32.1                      2021-01-27                       overview(3)
Impressum