Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python detect if tkinter page closed

import tkinter as tk
from tkinter import messagebox

root = tk.Tk()

def on_closing():
    if messagebox.askokcancel("Quit", "Do you want to quit?"):
        root.destroy()

root.protocol("WM_DELETE_WINDOW", on_closing)
root.mainloop()
Comment

PREVIOUS NEXT
Code Example
Python :: python remove non letters from string 
Python :: displaying flash message django 
Python :: install python-dev packages 
Python :: how to loop through dates in python 
Python :: convert into date python 
Python :: matplotlib log 
Python :: python rotate screen 
Python :: how to find geometric mean in python 
Python :: format to 2 or n decimal places python 
Python :: how to autosave in python 
Python :: python reimport py file 
Python :: Python project root dir 
Python :: python euclidean algorithm 
Python :: python get all variables in class 
Python :: module not found not module name channels in python 
Python :: django forms set class 
Python :: python read csv into array 
Python :: translate sentences in python 
Python :: pytorch plt.imshow 
Python :: python find dict in list of dict by id 
Python :: pandas shuffle rows 
Python :: change date format python 
Python :: filter dataframe columns vy a list of columns 
Python :: python open each file in directory 
Python :: how to check for a particular word in a text file using python 
Python :: python write to command prompt 
Python :: how to create a keylogger in python 
Python :: bee movie script 
Python :: run django app locally 
Python :: python count words in file 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =