zoukankan      html  css  js  c++  java
  • 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 结果

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

  • 相关阅读:
    BZOJ1040: [ZJOI2008]骑士
    Codeforces 849D.Rooter's Song
    POJ4852 Ants
    NOIP模拟赛 17.10.10
    Codeforces 851D Arpa and a list of numbers
    BZOJ2529: [Poi2011]Sticks
    BZOJ1826: [JSOI2010]缓存交换
    POJ3579 Median
    codevs1214 线段覆盖
    POJ2230 Watchcow
  • 原文地址:https://www.cnblogs.com/it-tsz/p/10583017.html
Copyright © 2011-2022 走看看