Experimenting with the code

The best way to experience this piece of code is to make the following tweaks one by one, run the program, and resize the window to see the effect of each option.

As a first tweak, change the weights to 0:

 Grid.rowconfigure(root, x, weight=0) Grid.columnconfigure(root, x, weight=0)

This will make the window non-responsive again.

Next, reassign the weights back to 1 and then comment out one of the two lines and see the difference. If you comment out the rowconfigure line the buttons will be responsive in the y direction, but non-responsive in the x direction and vice versa for columnconfigure.

Restore the program to its original state and then assign a different weight in each loop by changing the weight to x

Get Tkinter GUI Application Development Blueprints - Second 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.