Python GUI - Tkinter tkMessageBox
tkMessageBox模块用于显示在您的应用程序的消息框。此模块提供了一个功能,您可以用它来显示适当的消息.
这些功能有些是showinfo,showwarning,showerror,askquestion,askokcancel,askyesno,askretryignore.
方法:
这里是一个简单的语法来创建这个widget:
tkMessageBox.FunctionName(title, message [, options])
参数:
FunctionName: 这是相应的消息框函数的名称.
title: 这是在一个消息框,标题栏显示的文本.
message: 这是要显示的文字作为消息.
options: 选项有替代的选择,你可以用它来定制一个标准的消息框。一些可以使用的选项是默认的。默认选项是用来指定默认的按钮,如中止,重试,或忽略在消息框中。父选项是用来指定要显示的消息框上的顶层窗口.
If the standard message boxes are not appropriate, you can pick the closest alternative (askquestion, in most cases), and use options to change it to exactly suit your needs. You can use the following options (note that messageand title are usually given as arguments, not as options).
default constant
Which button to make default: ABORT, RETRY, IGNORE, OK, CANCEL,YES, or NO (the constants are defined in the tkMessageBox module).
icon (constant)
Which icon to display: ERROR, INFO, QUESTION, or WARNING
message (string)
The message to display (the second argument to the convenience functions). May contain newlines.
parent (widget)
Which window to place the message box on top of. When the message box is closed, the focus is returned to the parent window.
title (string)
Message box title (the first argument to the convenience functions).
type (constant)
Message box type; that is, which buttons to display:ABORTRETRYIGNORE, OK, OKCANCEL, RETRYCANCEL, YESNO, orYESNOCANCEL.
showinfo()

showwarning()

showerror ()

askquestion()

askokcancel()

askyesno ()

askretrycancel ()

例子:
自行尝试下面的例子:
import Tkinter
import tkMessageBox top = Tkinter.Tk()
def hello():
tkMessageBox.showinfo("Say Hello", "Hello World") B1 = Tkinter.Button(top, text = "Say Hello", command = hello)
B1.pack() top.mainloop()
这将产生以下结果:
不显示window root窗口
import Tkinter
import tkMessageBox top = Tkinter.Tk()
top.withdraw()
tkMessageBox.askyesno("Say Hello", "Hello World")
Python GUI - Tkinter tkMessageBox的更多相关文章
- Python GUI - tkinter
目录: Tkinter 组件 标准属性 几何管理 代码实例: 1. Label & Button 2. Entry & Text 3.Listbox列表 4.Radiobutton单选 ...
- python gui tkinter快速入门教程 | python tkinter tutorial
本文首发于个人博客https://kezunlin.me/post/d5c57f56/,欢迎阅读最新内容! python tkinter tutorial Guide main ui messageb ...
- Python GUI——tkinter菜鸟编程(中)
8. Radiobutton 选项按钮:可以用鼠标单击方式选取,一次只能有一个选项被选取. Radiobutton(父对象,options,-) 常用options参数: anchor,bg,bitm ...
- python gui tkinter用法杂记
1.treeview遍历 iids = tree.selection() t = tree.get_children() for i in t: print(tree.item(i,'values') ...
- Python GUI tkinter 学习笔记(一)
第一个python程序 #!/usr/bin/python # -*- coding: UTF-8 -*- from Tkinter import * # 创建一个根窗口,其余的控件都在这个窗口之上 ...
- Python GUI tkinter 学习笔记(三)
草稿 # -*- coding: utf-8 -*- from Tkinter import * root = Tk() Label(root, text = "First").g ...
- Python GUI tkinter 学习笔记(二)
第二个程序 # -*- coding: utf-8 -*- from Tkinter import * class App: def __init__(self, master): # frame 创 ...
- Python GUI with Tkinter (from youtube) 在youtube上能找到很多编程视频...
Python GUI with Tkinter - 1 - Introduction以上链接是一个python tkinter视频系列的第一讲的链接.虽然英语不好,但是,程序还是看得懂的(照着做就可以 ...
- Python GUI之tkinter窗口视窗教程大集合(看这篇就够了)
一.前言 由于本篇文章较长,所以下面给出内容目录方便跳转阅读,当然也可以用博客页面最右侧的文章目录导航栏进行跳转查阅. 一.前言 二.Tkinter 是什么 三.Tkinter 控件详细介绍 1. T ...
随机推荐
- yum的初步了解与使用
什么是yum Yum(Yellow dog Updater,Modified)是一个基于RPM包管理的字符前端软件包管理器.能够从指定的服务器自动下载RPM包并且安装,可解决软件包相关依赖性,并且一次 ...
- Mybatis源码解析-BoundSql
mybatis作为持久层,其操作数据库离不开sql语句.而BoundSql则是其保存Sql语句的对象 前提 针对mybatis的配置文件的节点解析,比如where/if/trim的节点解析可见文章Sp ...
- 【Beta阶段】第五次scrum meeting
Coding/OSChina 地址 1. 会议内容 学号 主要负责的方向 昨日任务 昨日任务完成进度 接下去要做 99 PM 查阅换肤功能相关资料 100% 着手联网功能 100 DEV 完成分享邀请 ...
- JAVA课设--五子棋--团队博客
1 团队名称.团队成员介绍 徐璐琳 网络1511班 201521123010 祁泽文 网络1511班 201521123011 张晨晨 网络1511班 201521123009 2 项目git地址 团 ...
- 201521123038 《Java程序设计》 第十二周学习总结
201521123038 <Java程序设计> 第十二周学习总结 1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结多流与文件相关内容. 2. 书面作业 将Student ...
- 201521123012 《Java程序设计》第九周学习总结
1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结异常相关内容. 2. 书面作业 1.本次PTA作业题集异常 常用异常 题目5-1 1.1 截图你的提交结果(出现学号) 1.2 自己 ...
- python基础之socket
一.osi七层 完整的计算机系统由硬件,操作系统,软件组成. 互联网的核心就是由一堆协议组成,协议就是标准,如全世界通信的标准就是英语. 如果把计算机比作人,那么互联网协议就是计算机界的英语,所有计算 ...
- mysql5.6.24的安装与简单使用
1, 下载绿色版Mysql5.6.24 http://dlsw.baidu.com/sw-search-sp/soft/ea/12585/mysql-5.6.24-win32.1432006610.z ...
- Java图的邻接矩阵实现
/** * * 图的邻接矩阵实现 * @author John * * @param <T> */ class AMWGraph<T> { private ArrayList& ...
- oracle-外连接left join的应用
需求 自助设备交易统计 输入项 类型 可为空 备注 机构 选择 Y 采用下拉框的形式 终端号 手输 Y 与柜员号二选一 交易柜员号 手输 与终端号二选一 时间 选择 N 时间区间 状态 多选 设备状态 ...