为什么不能在OS X上的tkMessagebox.askyesno()上更改图标? [英] Why can't I change the icon on a tkMessagebox.askyesno() on OS X?

查看:151
本文介绍了为什么不能在OS X上的tkMessagebox.askyesno()上更改图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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',而不是TrueFalse.不过,这是唯一的真实选择.

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()上更改图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆