Freeze the Tkinter Window Frame Size

  1. Frame resizable Method
  2. Frame minsize and maxsize Method

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 no matter the label widget in the frame is too long or too short.

Photoshop CC - How To How To Resize...
Photoshop CC - How To How To Resize Image Without Stretching It

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()

Related Article - Tkinter Geometry

  • Set a Tkinter Window With a Constant Size
  • Create Full Screen Window in Tkinter