Gridding, Resizing, and Geometry

The text, listbox, and canvas widgets support geometry gridding. This is an alternate interpretation of the main window geometry that is in terms of grid units, typically characters, as opposed to pixels. The setGrid attribute is a boolean that indicates if gridding should be turned on. The listbox and text widgets define a grid size that matches their character size. Example 41-1 on page 572 sets up gridding for a canvas.

When a widget is gridded, its size is constrained to have a whole number of grid units displayed. The height will be constrained to show a whole number of text lines, and the width will be constrained to show a whole number of average width characters. This affects interactive resizing by users, ...

Get Practical Programming in Tcl & Tk, Third Edition 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.