This makes the button fill the whole window initially (its allocation is expanded, and
it is stretched to fill that allocation). It also makes the button grow as the parent window
is resized. As shown in Figure 7-9, the button in this window does expand when its
parent expands, but only along the X horizontal axis.
Figure 7-9. Resizing with expand=YES, fill=X
To make the button grow in both directions, specify both expand=YES and fill=BOTH in
the pack call; now resizing the window makes the button grow in general, as shown in
Figure 7-10. In fact, for more fun, maximize this window to fill the entire screen; you’ll
get one very big tkinter button indeed.
Figure 7-10. Resizing with expand=YES, fill=BOTH
Figure 7-8. pack(side=LEFT, expand=YES, fill=X)
Adding Buttons and Callbacks| 381