首页 > Python基础教程 >
-
python 3.4 中原来的tkinter组件的tkMessageBox变成啥了
在python3.4中,原来的 Tkinter 变成 tkinter ,原来的tkMessageBox变成tkinter.messagebox,使用方式如下:
import tkinter.messagebox tkinter.messagebox.askokcancel('提示','这是一个消息框')
效果如下:
备注:
tkinter.messagebox中有如下函数:
askokcancel(title=None, message=None, **options)
Ask if operation should proceed; return true if the answer is ok
askquestion(title=None, message=None, **options)
Ask a question
askretrycancel(title=None, message=None, **options)
Ask if operation should be retried; return true if the answer is yes
askyesno(title=None, message=None, **options)
Ask a question; return true if the answer is yes
askyesnocancel(title=None, message=None, **options)
Ask a question; return true if the answer is yes, None if cancelled.
showerror(title=None, message=None, **options)
Show an error message
showinfo(title=None, message=None, **options)
Show an info message
showwarning(title=None, message=None, **options)
Show a warning message