问题描述
tkMessageBox.askyesno('Title', 'Message', icon=tkMessageBox.WARNING)
只是给了我火箭图标.
tkMessageBox.askyesno('Title', 'Message', icon=tkMessageBox.WARNING)
on OS X just gives me the rocket icon.
我知道OS X和tkMessageBox图标有些奇怪,因为tkMessageBox.showerror()
仅显示了火箭图标,但是tkMessageBox.showwarning
显示了一个黄色三角形(角上有一个小火箭)
I know there is some weirdness with OS X and tkMessageBox icons because tkMessageBox.showerror()
just shows the rocket icon, but tkMessageBox.showwarning
shows a yellow triangle (with a small rocket in the corner)
这是一个错误吗?
是否有一些解决方法来获得警告三角形和是/否按钮,而不必从头开始制作我自己的消息框窗口?
Is there some workaround to get a warning triangle and Yes/No buttons without having to resort to making my own message box window from scratch?
推荐答案
我找到了解决方法:
tkMessageBox.askretrycancel(title, message, type=tkMessageBox.YESNO)
似乎可以工作,但是同时按下两个按钮都返回False
,因此没有任何用处.
seems to work, but both buttons presses return False
, so it's not of any use.
tkMessageBox.showwarning(title, message, type=tkMessageBox.YESNO)
也可以工作,但请注意,它返回'yes'
或'no'
,而不是True
或False
.不过,这是唯一的真实选择.
does also work work, but be aware that it returns 'yes'
or 'no'
, not True
or False
. It's the only real option though.
如果有人可以告诉我它是否是一个错误,我仍然很感兴趣.
I would still be interested if anyone can tell me whether it is a bug.
这篇关于为什么不能在OS X上的tkMessagebox.askyesno()上更改图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!