Tkinter creates a default window with its default size while initializing the application. We can customize the geometry of the window using the geometry method.
However, in order to maximize the window, we can use the state() method which can be used for scaling the tkinter window. It maximizes the window after passing the “zoomed” state value to it.
#Import the required libraries from tkinter import * #Create an instance of tkinter frame win= Tk() #Set the geometry of frame win.geometry("600x400") #Create a text label Label(win,text="It takes only 21 days to create a new Habit", font=('Times New Roman bold',15)).pack(pady=20) #Maximize the window Size using attributes property win.state('zoomed') win.mainloop()
Running the above code will maximize the tkinter window.