TIP #21: Asymmetric Padding in the Pack and Grid Geometry Managers
_____________________________________________________________________________
TIP:	21
Title:	Asymmetric Padding in the Pack and Grid Geometry Managers
Version:	$Revision: 1.6 $
Authors:	D. Richard Hipp <drh@hwaci.com>
State:	Final
Type:	Project
Tcl-Version:	8.4
Vote:	Done
Created:	Sun Jan 14 00:00:00 UTC 2001
Abstract
Proposes modifying the pack and grid geometry managers to support asymmetric padding.
Rationale
The pack and grid geometry managers allow for adding extra space to the left and right of a widget using the -padx option, and above and below the widget using -pady. But there is currently no way to add different amounts of space on opposite sides of the widget. When a layout requires differing amounts of space on opposite sides of the same widget, the usual solution is to introduce extra frame widgets to act as spacers. But that both complicates the code unnecessarily and obscures the intent of the programmer.
Proposed Enhancement
This TIP proposes to modify the -padx and -pady of both the pack and grid geometry managers as follows: If the argument to -padx or -pady is a screen distance, that distance is added to both sides of the widget. (This is the current behavior.) If the argument is a list of two screen distances, then the first screen distance is the extra space to add to the left or top and the second screen distance is the extra space to add to the right or bottom.
The changes to -padx and -pady occur in pack only if the pack geometry manager is used according to the new syntax. The older deprecated syntax (that dates from Tk3.3) will not support asymmetric padding.
Copyright
This document has been placed in the public domain.
Patch
Patches to implement asymmetric padding in the pack and grid geometry managers, as described above, are available at http://www.hwaci.com/sw/asym_pad_patch_2.txt
_____________________________________________________________________________
Colophon
TIP AutoGenerator - written by Donal K. Fellows