My program has to do some task after the tkinter window is closed.
When the 'X' button is pressed, it should print "The window is closed, how to do it"???
my code is
from tkinter import *
root = Tk()
Label(root, text = "This is for stackoverflow('X' button clicked code)").pack()
root.mainloop()
Actually I am looking for something like return value...
You can use
WM_DELETE_WINDOWprotocol to detect if root window is closed.Also,
mainloop()is a sort of while loop which keeps the GUI running.You can also add
print('The window is closed.')after it