How to Freeze the Tkinter Window Frame Size

In some scenarios, we want the Tkinter window frame size is frozen, or in other words, the frame is not resizable. For example, the window frame keeps the same not matter the label widget in the frame is too long or too short.

Frame resizable method

resizable(width= , height=) configures the frame window size resizable or not in width and height.

resizable(width = False) only freezes the window width, meanwhile resizable(height = False) only freezes the window height. The whole window size is frozen by using resizable(width=False, height=False), or simply resizable(False, False).

try:
    import Tkinter as tk
except:
    import tkinter as tk
    

    
app = tk.Tk()
app.title("Frame Window Size Frozen")
app.geometry('300x200')

app.resizable(width=False, height=False)
app.mainloop()

Frame minsize and maxsize method

minsize and maxsize methods are normally used to set the minimum and maximum window size, but could also freeze the window size if you set both minimum and maximum sizes to be identical.

try:
    import Tkinter as tk
except:
    import tkinter as tk
    

    
app = tk.Tk()
app.title("Frame Window Size Frozen")

app.minsize(width=600, height=400)
app.maxsize(width=600, height=400)
app.mainloop()