Removing minimize/maximize buttons in Tkinter

TkinterServer Side ProgrammingProgramming

When we run our tkinter application, it initially displays a window that has an interface to display all the widgets. Eventually, we can remove the maximizing and minimizing property of the displayed window by using the resizable(boolean) method. It takes two Boolean values that refer to the status of width and height of the window. We generally disable the max and min resizing property by assigning zero to both values of width and height.

Example

#Import the required library
from tkinter import*
#Create an instance of tkinter frame
win= Tk()
#Set the geometry
win.geometry("750x250")
#Disable the resizable Property
win.resizable(False, False)
#Create an Label Widget
Label(win, text= "This Window can't be resized", font= ('Helvetica 15
underline')).pack(pady=20)
win.mainloop()

Output

Running the above code will display a non-resizable window.

raja
Published on 16-Apr-2021 07:10:58
Advertisements