赞
踩
查源码,运行源码文件,展示测试案例。
- from tkinter import *
- from tkinter.messagebox import *
-
- #1.创建窗口
- root = Tk()
- #2.创建组件摆放组件
- b = Button(root,text='测试弹窗')
- b.pack()
- #3.绑定事件
- def a(a):
- print("info", showinfo("Spam", "Egg Information"))
-
- b.bind('<Button-1>',a)
-
- root.mainloop()
- from tkinter import *
- from tkinter.messagebox import *
-
- #1.创建窗口
- root = Tk()
- #2.创建组件摆放组件
- b = Button(root,text='测试弹窗')
- b.pack()
- #3.绑定事件
- def a(a):
- print("warning", showwarning("Spam", "Egg Warning"))
-
- b.bind('<Button-1>',a)
-
- root.mainloop()
- from tkinter import *
- from tkinter.messagebox import *
-
- #1.创建窗口
- root = Tk()
- #2.创建组件摆放组件
- b = Button(root,text='测试弹窗')
- b.pack()
- #3.绑定事件
- def a(a):
- print("error", showerror("Spam", "Egg Alert"))
-
- b.bind('<Button-1>',a)
-
- root.mainloop()
- from tkinter import *
- from tkinter.messagebox import *
-
- #1.创建窗口
- root = Tk()
- #2.创建组件摆放组件
- b = Button(root,text='测试弹窗')
- b.pack()
- #3.绑定事件
- def a(a):
- print("question", askquestion("Spam", "Question?"))
-
-
- b.bind('<Button-1>',a)
-
- root.mainloop()
- from tkinter import *
- from tkinter.messagebox import *
-
- #1.创建窗口
- root = Tk()
- #2.创建组件摆放组件
- b = Button(root,text='测试弹窗')
- b.pack()
- #3.绑定事件
- def a(a):
- print("proceed", askokcancel("Spam", "Proceed?"))
-
-
- b.bind('<Button-1>',a)
-
- root.mainloop()
- from tkinter import *
- from tkinter.messagebox import *
-
- #1.创建窗口
- root = Tk()
- #2.创建组件摆放组件
- b = Button(root,text='测试弹窗')
- b.pack()
- #3.绑定事件
- def a(a):
- print("yes/no", askyesno("Spam", "Got it?"))
-
-
- b.bind('<Button-1>',a)
-
- root.mainloop()
- from tkinter import *
- from tkinter.messagebox import *
-
- #1.创建窗口
- root = Tk()
- #2.创建组件摆放组件
- b = Button(root,text='测试弹窗')
- b.pack()
- #3.绑定事件
- def a(a):
- print("yes/no/cancel", askyesnocancel("Spam", "Want it?"))
-
-
- b.bind('<Button-1>',a)
-
- root.mainloop()
- from tkinter import *
- from tkinter.messagebox import *
-
- #1.创建窗口
- root = Tk()
- #2.创建组件摆放组件
- b = Button(root,text='测试弹窗')
- b.pack()
- #3.绑定事件
- def a(a):
- print("try again", askretrycancel("Spam", "Try again?"))
-
-
- b.bind('<Button-1>',a)
-
- root.mainloop()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。