1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| #声明函数 def okcancel(): #弹出对话框 result = tkinter.messagebox.askokcancel(title = 'okcancel',message = '先生,反已经做好了,要吃饭码?') print(result) #添加按钮 btn1 = tkinter.Button(root,text = 'okcancel',command = okcancel) btn1.pack()
#声明函数 def question(): # 弹出对话框 result = tkinter.messagebox.askquestion(title = 'question',message = '你是男人吗?') print(result) #添加按钮 btn2 = tkinter.Button(root,text = 'question',command = question) btn2.pack()
#声明函数 def retrycancel(): # 弹出对话框 result = tkinter.messagebox.askretrycancel(title = 'retrycancel',message = '女生拒绝了你,你要继续追码??') print(result) #添加按钮 btn3 = tkinter.Button(root,text = 'retrycancel',command = retrycancel) btn3.pack()
#声明函数 def yesno(): # 弹出对话框 result = tkinter.messagebox.askyesno(title = 'yesno',message = '你喜欢日本人吗?') print(result) #添加按钮 btn4 = tkinter.Button(root,text = 'yesno',command = yesno) btn4.pack()
#声明函数 def error(): # 弹出对话框 tkinter.messagebox.showerror(title = '出错了',message = '你的年龄不符合要求!') #添加按钮 btn5 = tkinter.Button(root,text = 'error',command = error) btn5.pack()
#声明函数 def warning(): # 弹出对话框 tkinter.messagebox.showwarning(title = '警告',message = '18岁以下禁止进入') #添加按钮 btn6 = tkinter.Button(root,text = 'warning',command = warning) btn6.pack()
#声明函数 def info(): # 弹出对话框 tkinter.messagebox.showinfo(title = '信息提示',message = '1区王者已上线!') #添加按钮 btn7 = tkinter.Button(root,text = 'info',command = info) btn7.pack()
|