Tkinter——Pop-up dialogs——(1)tkMessageBox
来源:互联网 发布:mac dock栏怎么设置 编辑:程序博客网 时间:2024/06/13 07:44
tkMessageBox中含有8种弹出窗口。各窗口调用格式如下:
answer = tkMessageBox.function(title, message, options)参数说明:
function:弹出窗口类型。详见示例代码的 msg_boxes 列表。
title:弹出窗口标题。
message:弹出信息,可以“\n”换行。
options: [ default = ... ] [ icon = ... ] [ parent = ... ]
返值:
—————————————————————————————————————————————————
注: Close 列表示不选择给定选项,点右上角的“X”关闭弹窗时的返值。2种弹窗无法如此关闭。
示例代码如下:
import Tkinter as tkimport tkMessageBox as mbmsg_boxes = ['askokcancel', 'askquestion', 'askretrycancel', 'askyesno', 'askyesnocancel', 'showerror', 'showinfo', 'showwarning']def demo0(): answer = mb.askokcancel(msg_boxes[0], 'Hello world') print answerdef demo1(): answer = mb.askquestion(msg_boxes[1], 'Hello world') print answerdef demo2(): answer = mb.askretrycancel(msg_boxes[2], 'Hello world') print answerdef demo3(): answer = mb.askyesno(msg_boxes[3], 'Hello world') print answerdef demo4(): answer = mb.askyesnocancel(msg_boxes[4], 'Hello world') print answerdef demo5(): mb.showerror(msg_boxes[5], 'Hello world')def demo6(): mb.showinfo(msg_boxes[6], 'Hello world')def demo7(): mb.showwarning(msg_boxes[7], 'Hello world')root = tk.Tk()btn0 = tk.Button(root, text=msg_boxes[0], width=20, command=demo0)btn0.pack()btn1 = tk.Button(root, text=msg_boxes[1], width=20, command=demo1)btn1.pack()btn2 = tk.Button(root, text=msg_boxes[2], width=20, command=demo2)btn2.pack()btn3 = tk.Button(root, text=msg_boxes[3], width=20, command=demo3)btn3.pack()btn4 = tk.Button(root, text=msg_boxes[4], width=20, command=demo4)btn4.pack()btn5 = tk.Button(root, text=msg_boxes[5], width=20, command=demo5)btn5.pack()btn6 = tk.Button(root, text=msg_boxes[6], width=20, command=demo6)btn6.pack()btn7 = tk.Button(root, text=msg_boxes[7], width=20, command=demo7)btn7.pack()root.mainloop()
0 0
- Tkinter——Pop-up dialogs——(1)tkMessageBox
- SharePoint 2013 Pop-Up Dialogs
- SharePoint 2013 Pop-Up Dialogs
- SharePoint 2010 Pop-Up Dialogs
- SharePoint 2010 Pop-Up Dialogs SharePoint 2010 弹出对话框
- API Guides(五)——<Activity> To Dialogs
- Revit二次开发入门——Task Dialogs
- python—Tkinter GUI编程
- 《Android开发从零开始》——39.Dialogs学习
- PyQt学习笔记(2)——Dumb Dialogs
- PyQt学习笔记(3)——Standard Dialogs
- PyQt学习笔记(4)——Smart Dialogs
- QML官方系列教程——Qt Quick Dialogs
- Tkinter GUI编程——简介
- Python GUI——Tkinter~简单入门
- python——Tkinter的简单学习
- Python ——tkinter应用之时钟
- Tkinter 学习笔记 —— 布局管理
- CentOS 7 安装 redis3.0.7 详细步骤
- 计算均值mean的MapReduce程序Computing mean with MapReduce
- 第2讲 示例1—旱冰场造价
- 语音模块LD3320控制LED灯
- Java反射的作用
- Tkinter——Pop-up dialogs——(1)tkMessageBox
- L版本在蓝牙设置界面关闭蓝牙再打开时,其他手机搜索不到该手机
- 更为详细的介绍Hadoop combiners-More about Hadoop combiners
- 网易游戏2016研发实习生招聘在线编程题目 推箱子
- infinispan项目中的配置
- ios ffmpeg加字幕
- 网易笔试题
- 实现Hadoop的Writable接口Implementing Writable interface of Hadoop
- apicloud数据云api restapi操作