Controlling layout with the grid command

Care must be taken in packing the widgets to ensure that the desired layout is obtained. The pack command provides a convenient method of geometry management for simple forms. However, for more complex forms, the grid command allows you to manage your widget placement by creating and configuring rows and columns for widget placement.

To illustrate this better, think of the grid as being similar to a table or a spreadsheet, as it contains rows and columns, as follows:

 

Column 0

Column 1

Column 2

Row 0

   

Row 1

   

Row 2

   

Please note that the column and row numbering are zero-based. This is the grid layout that we will use in the following example.

Based on the options provided, when invoked, the grid ...

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.