Controlling layout with the pack command
Tk provides three methods of geometry management—pack
, grid
, and the rarely used place
command. We will be covering the pack
and grid
commands. The pack
command is the basic geometry manager for Tk. When invoked, the pack
command instructs the packer to arrange the widgets as specified. The packer is a geometry manager that arranges the elements of a window in order around the edges. In the following examples, we will see how to use the pack
command.
Based on the options provided when invoked the pack
command assumes several forms. The syntactical options are as follows:
Option |
Interpretation |
---|---|
|
Behaves in the same manner as |
|
Get Tcl/Tk 8.5 Programming Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.