• python界面Tkinter编程(tkMessageBox对话框使用)


    python界面Tkinter编程(tkMessageBox对话框使用)

    转载 https://blog.csdn.net/m_buddy/article/details/80105154

    1. 前言

    tkMessageBox是Tkinter中常用的对话框控件,可以和方便实现相关对话框的弹出等,类似于MFC中的MessageBox。在Tkinter中定义了多种类型的对话框,其基本的调用形式为:

    tkMessageBox.xxxxx(title, message, options)
    • 1

    其中的title自然是对话框的标题,message是显示的内容,对于options

    属性含义
    default 设置默认的选择项,有tkMessageBox: CANCEL, IGNORE, OK, NO, RETRY, or YES
    icon 设置对话框的图标,有tkMessageBox: ERROR, INFO, QUESTION, WARNING
    parent 指定对话框的父窗口

    2. tkMessageBox中的对话框类型

    2.1 示例代码

    tkMessageBox.askokcancel('askokcancel', 'hello', parent=root_window,)
    tkMessageBox.askquestion('askquestion', 'hello', parent=root_window)
    tkMessageBox.askretrycancel('askretrycancel', 'hello', parent=root_window)
    tkMessageBox.askyesno('askyesno', 'hello', parent=root_window)
    tkMessageBox.showinfo('showinfo', 'hello', parent=root_window)
    tkMessageBox.showerror('showerror', 'hello', parent=root_window)
    tkMessageBox.showwarning('showwarning', 'hello', parent=root_window)

    2.2 结果

    这里写图片描述 
    这里写图片描述 
    这里写图片描述 
    这里写图片描述 
    这里写图片描述 
    这里写图片描述 
    这里写图片描述

  • 相关阅读:
    第6次实践作业
    第5次实践作业
    第4次实践作业
    第3次实践作业
    第二次实践作业
    2020系统综合实践 第1次实践作业
    软工实践个人总结
    第11组 Beta版本演示
    第11组 Beta冲刺(4/5)
    第11组 Beta冲刺(5/5)
  • 原文地址:https://www.cnblogs.com/it-tsz/p/10583017.html
Copyright © 2020-2023  润新知