|Title:||Asymmetric Padding in the Pack and Grid Geometry Managers|
|Version:||$Revision: 1.6 $|
|Author:||D. Richard Hipp <drh at hwaci dot com>|
|Created:||Sunday, 14 January 2001|
Proposes modifying the pack and grid geometry managers to support asymmetric padding.
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.
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.
This document has been placed in the public domain.
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
[Index] [History] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]TIP AutoGenerator - written by Donal K. Fellows