How can I prevent a window from being resized with Tkinter?

TkinterPythonServer Side ProgrammingProgramming

Tkinter windows can be resized automatically by hovering and pulling over the window. We can disable the resizable property using the resizable(boolean value) method. We will pass false value to this method which will disable the window to be resized.

Example

#Import the tkinter library
from tkinter import *

#Create an instance of tkinter frame
win = Tk()

#Set the geometry
win.geometry("650x250")

Label(win, text= "Hello World", font=('Times New Roman bold',
20)).pack(pady=20)

#Make the window resizable false
win.resizable(False,False)

win.mainloop()

Output

Running the above code will display the following the tkinter window, but you won't be able to resize it.

raja
Published on 27-Mar-2021 06:20:58
Advertisements