Chapter 12. Frames

A frame widget is a boring widget at first glance. All it does is provide a place for other widgets to sit. This doesn't seem important, but it is. The geometry managers provided with Perl/Tk have some limitations (see Chapter 2), and we can use frames to help them do their jobs better. We'll use pack as our example geometry manager throughout this chapter because it seems to be the most popular, but remember that the basic rules for using a frame apply to the other geometry managers as well.

A frame widget's job is to contain other widgets, accommodating the size of the widgets within. If you don't have any widgets packed into the frame, you won't see the frame. If the widgets inside the frame are resized for any reason, the frame will try to resize as well (either larger or smaller). [1]

[1] You can change this behavior by using packPropagate() or gridPropagate().

Get Learning 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.