A quit button that verifies exit requests : Dialog « Tkinker « Python Tutorial






A quit button that verifies exit requests
from Tkinter import *                    
from tkMessageBox import askokcancel     
     
class Quitter(Frame):                    
    def __init__(self, parent=None):     
        Frame.__init__(self, parent)
        self.pack()
        widget = Button(self, text='Quit', command=self.quit)
        widget.pack(side=LEFT)
    def quit(self):
        ans = askokcancel('Verify exit', "Really quit?")
        if ans: Frame.quit(self)
     
Quitter().mainloop()








18.10.Dialog
18.10.1.OK Cancel message boxOK Cancel message box
18.10.2.Color dialog
18.10.3.File dialog
18.10.4.Question dialogQuestion dialog
18.10.5.Error dialogError dialog
18.10.6.Message boxMessage box
18.10.7.Model dialogModel dialog
18.10.8.Popup dialogPopup dialog
18.10.9.A quit button that verifies exit requestsA quit button that verifies exit requests