Geometry Management Summary

You now know more about the different geometry managers than you’ll ever need to write a successful Perl/Tk application. Here are some helpful hints on deciding which geometry manager to use:

  • pack is good for general purpose use and will be your choice about 95% of the time.

  • grid is perfect for those situations in which you would like to create a columnar layout similar to a spreadsheet. Options allow you to change the sizes of rows and/or columns easily.

  • place is most useful when you want your widget to stay in a position or size that is relative to the widget that created it. When used correctly, it can be very powerful.

  • form is powerful, but difficult to get used to; not for the faint of heart. Check future releases of the Tk module for updates to this geometry manager.

No matter which manager you use, take the time to get the widgets on your window where they belong (or more likely, where you want them). There’s nothing more unsettling than a Button that looks like it just doesn’t belong in the window.

As you read through this book, you’ll notice that some of the option names for the geometry managers are also option names when you are creating or configuring a widget type. For example, you can specify the -width of a Button without using place. Always keep in mind the context in which the option is used. Sometimes the functional difference is very subtle.

Get Mastering Perl/Tk 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.