4

tkMessageBox.askyesno('Title', 'Message', icon=tkMessageBox.WARNING) on OS X just gives me the rocket icon.

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 this is a bug?

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?

Grezzo
  • 2,220
  • 2
  • 22
  • 39
  • 1
    Question is duplicate of https://stackoverflow.com/questions/59622115 see https://stackoverflow.com/a/72537201/566778 for a solution – Nico de Groot Jun 08 '22 at 09:01

2 Answers2

1

I found a solution:

tkMessageBox.askretrycancel(title, message, type=tkMessageBox.YESNO)

seems to work, but both buttons presses return False, so it's not of any use.

tkMessageBox.showwarning(title, message, type=tkMessageBox.YESNO)

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.

Grezzo
  • 2,220
  • 2
  • 22
  • 39
1

You can use icon='warning' instead of icon=tkMessageBox.WARNING

I just tried that on Windows. Sorry I don't have OSX to test

Douglas
  • 11
  • 1