import tkinter as tk
import tkinter.messagebox
window = tk.Tk()
window.title('my window')
window.geometry('320x640')
def hit_me():
# tk.messagebox.showinfo(title='', message='') # 提示信息对话窗
# tk.messagebox.showwarning() # 提出警告对话窗
# tk.messagebox.showerror() # 提出错误对话窗
# tk.messagebox.askquestion() # 询问选择对话窗........
# tk.messagebox.askyesno(title='Hi',message='hahahaha')
# tk.messagebox.askretrycancel(title='Hi',message='hahahaha')
tk.messagebox.askokcancel(title='Hi', message='hahahaha')
# 选择弹窗中的按钮后,会返回对应的一个值
# def hit_me():
# print(tk.messagebox.askquestion(title='Hi', message='hahahaha'))
# 打印出所选项对应的返回值
tk.Button(window, text='hit me', command=hit_me).pack()
window.mainloop()