This method is used to set the maximum size of the root window (maximum size a window can be expanded). User will still be able to shrink the size of the window to the minimum possible. Syntax :
master.maxsize(height, width)
Here, height and width are in pixels. Code #1:
Python3
# importing only those functions# which are neededfrom tkinter import *from tkinter.ttk import *from time import strftime# creating tkinter windowroot = Tk()# Adding widgets to the root windowLabel(root, text = 'Lazyroar', font =('Verdana', 15)).pack(side = TOP, pady = 10)Button(root, text = 'Click Me !').pack(side = TOP)mainloop() |
Output : Initial size of the window (maximum size of the window is not set) 

Python3
# importing only those functions# which are neededfrom tkinter import *from tkinter.ttk import *from time import strftime# creating tkinter windowroot = Tk()# Fixing the size of the root window.# No one can now expand the size of the# root window than the specified one.root.maxsize(200, 200)# Adding widgets to the root windowLabel(root, text = 'Lazyroar', font =('Verdana', 15)).pack(side = TOP, pady = 10)Button(root, text = 'Click Me !').pack(side = TOP)mainloop() |
Output : Maximum expanded size of the window 
