Tkinter的MessageBox组件

MessageBox:用于显示你应用程序的消息框。

一、基本使用

1、消息提示框显示

代码如下:

# coding:utf8
from tkinter import *
""" 用来提醒用户,或是对一些不正常操作的警告信息;"""
import tkinter.messagebox as me


class App:
    def __init__(self, master):
        me.askquestion("询问", "是否喜欢我")
        me.askquestion("第一关", "点击是")
        me.askokcancel("第二关", "点击确定")
        me.askyesno("这是", "不知道")
        me.askretrycancel("这是2", "不知道2")
        me.showwarning("警告信息","最后一次警告")
        me.showerror("错误信息", "错误信息")
        me.showinfo("查询信息", "this is help")


root = Tk()
win = App(root)
root.mainloop()

效果如下:

imageimageimage


读书和健身总有一个在路上

原文地址:https://www.cnblogs.com/Renqy/p/12840825.html