Message box : Dialog « Tkinker « Python Tutorial






Message box
from Tkinter import *
from tkMessageBox import *
     
def callback():
    if askyesno('Verify', 'Do you really want to quit?'):
        showwarning('Yes', 'Quit not yet implemented')
    else:
        showinfo('No', 'Quit has been cancelled')
     
errmsg = 'Sorry, no Spam allowed!'
Button(text='Quit', command=callback).pack(fill=X)
Button(text='Spam', command=(lambda: showerror('Spam', errmsg))).pack(fill=X)
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