What is the difference between root.destroy() and root.quit() in Tkinter(Python)?

TkinterPythonServer Side ProgrammingProgramming

When we invoke the destroy() method with the tkinter window object, it terminates the mainloop process and destroys all the widgets inside the window. Tkinter destroy() method is mainly used to kill and terminate the interpreter running in the background.

However, quit() method can be invoked in order to stop the process after the mainloop() function. We can demonstrate the functionalities of both methods by creating a button Object.


#Import the required libraries
from tkinter import *

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

#Set the geometry of frame

#Define a function for Button Object
def quit_win():
def destroy_win():

#Button for Quit Method
Button(win,text="Quit", command=quit_win, font=('Helvetica

#Button for Destroy Method
Button(win, text= "Destroy", command=destroy_win, font=('Helvetica


Running the code will display a window with two buttons “Quit” and “Destroy” respectively.

Warningquit() will terminate the application abruptly, hence it is recommended that you close the application from the manager after execution.

Updated on 26-Mar-2021 10:19:20