A note on window responsiveness

We used .grid_propagate(False) in this program to ensure that our frames did not shrink to fit their contents, but rather stayed at a fixed height and width that we had specified while making the frames.

This served us well for this example, but this made our window and its content fixed in size. This is what you would typically call a non-responsive window.

Let us take a look at the program nonresponsive.py as an example of a non-responsive window. This program simply draws 10 buttons in a row:

from tkinter import Tk, Buttonroot = Tk()for x in range(10): btn = Button(root, text=x ) btn.grid(column=x, row=1, sticky='nsew')root.mainloop()

Run this program and resize the window. These buttons are drawn on the ...

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.