|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 minghan 于 2020-3-17 15:23 编辑
大佬们好
我在使用messagebox时,在option参数上遇到了麻烦
能帮忙指点一二吗?不胜感激
代码如下:
- import tkinter as tk
- import tkinter.messagebox as mb
- root = tk.Tk()
- opt = {'parent' : root}
- mb.askquestion(title = '测试', message = 'option参数怎么用???', option = opt)
- root.mainloop()
复制代码 问题如下:
- Traceback (most recent call last):
- File "E:/python/ch15-Tkinter/question.py", line 5, in <module>
- mb.askquestion(title = '测试', message = 'option参数怎么用???', option = opt)
- File "D:\Program Files\Python\Python38\lib\tkinter\messagebox.py", line 99, in askquestion
- return _show(title, message, QUESTION, YESNO, **options)
- File "D:\Program Files\Python\Python38\lib\tkinter\messagebox.py", line 72, in _show
- res = Message(**options).show()
- File "D:\Program Files\Python\Python38\lib\tkinter\commondialog.py", line 44, in show
- s = w.tk.call(self.command, *w._options(self.options))
- _tkinter.TclError: bad option "-option": must be -default, -detail, -icon, -message, -parent, -title, or -type
复制代码
- mb.askquestion(title = '测试', message = 'option参数怎么用???', parent=root)
复制代码
这样用就好了
|
|