askyesno( 窗口标题, 提示字符串) 创建对话框,提供Yes 和 No两个选项;
showwarning(窗口标题, 提示字符) 创建警告对话框,一个OK按钮和警告标识;
showinfo(窗口标题, 提示字符) 一个感叹号加OK按钮;
showerror(标题, 提示字符) 一个❌和OK按钮;
总结一下代码from tkinter import *
from tkinter.messagebox import *
class InFo():
def asktes(self):
askyesno('one', 'method one')
def showwar(self):
showwarning('two', 'method two')
def showin(self):
showinfo('three', 'method three')
def tool(self):
Button(text='one', command=self.asktes).pack(fill=X)
Button(text='two', command=self.showwar).pack(fill=X)
Button(text='three', command=self.showin).pack(fill=X)
errmsg = 'method four'
Button(text='four', command=(lambda: showerror('four', errmsg))).pack(fill=X)
mainloop()
info = InFo()
info.tool()



