Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, tutorials, and more.

Widget Overview

All Tk widgets are created by a Tcl command of the same name as
the widget. These widget creation commands have the form:

widgetCmd pathName [option value...]

where widgetCmd is the name of the
widget type desired (e.g., button or
listbox) and pathName is
the pathname for the new widget. The Return value for the command is
pathName.

A widget’s pathname consists of a child name
appended to the pathname of its parent widget using a “.” character. The
child name is an arbitrary string that excludes the “.” character and is
unique among its siblings, the other widget children of its parent. The
pathname for the Tk main (or root) window is simply a single dot (i.e.,
“.”); its immediate children begin with a dot, and each additional level
of a child widget appears after an additional dot. This scheme is
analogous to file pathnames in the Unix file system, where the “/”
character is used as a directory name separator. For example, the
pathname of a frame widget named frame1 whose parent
is the main window would have the pathname .frame1. A
button widget named button1 who is a child of
frame1 would have the pathname
.frame1.button1. Almost all Tk commands require the
full pathname for arguments that specify a widget.

When a new widget is created with the pathname
pathName, a new Tcl command is also defined with the same name. Invoking this command allows one to manipulate the widget in various ways depending on the arguments passed. The first argument to the widget’s command ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, interactive tutorials, and more.