0

I am using MessageDialog to create a Message like: enter image description here

dlg = wx.MessageDialog(self.GetParent(), 'Do you wish to Continue?', 'Warning!',wx.YES_NO| wx.ICON_WARNING)

I want it to be:

enter image description here

basicly all I need is to change the writing from Yes to something else. How can I do that?

java
  • 1,124
  • 2
  • 14
  • 33
  • As [this answers tells you](http://stackoverflow.com/questions/16242782/change-words-on-tkinter-messagebox-buttons), you cannot change the text on the buttons in default tkinter dialogs. So unfortunately, you'll need to make your own dialog... – Nander Speerstra Jan 19 '16 at 07:22
  • @NanderSpeerstra im using wxpython not thinker. – java Jan 19 '16 at 07:25
  • 3
    Sorry misread, then [you can do it](http://wxpython.org/Phoenix/docs/html/MessageDialog.html#MessageDialog.SetYesNoLabels): messageDialog.SetYesNoLabels("&Proceed", "&Don't proceed") (if I'm correct) :) – Nander Speerstra Jan 19 '16 at 07:34

1 Answers1

0

Since the link to the answer in the OP comments is broken, I thought I would post an answer for posterity:

dialog = wx.MessageDialog(self, f'Choose wisely', 'Choice Dialog', wx.YES_NO | wx.CANCEL | wx.CANCEL_DEFAULT | wx.ICON_INFORMATION)  # FYI, `ICON_QUESTION` doesn't work on Windows!
dialog.SetYesNoLabels('Label For Yes Button', 'Label For No Button')
answer = dialog.ShowModal()
dialog.Destroy()

# We changed the labels of the buttons on the Yes/No/Cancel dialog, but the IDs generated by pressing those
# buttons are the same as they would be if the button labels were not changed.
if answer == wx.ID_YES:
    # Do something for the "Yes" button press
    pass
elif answer == wx.ID_NO:
    # Do something for the "No" button press
    pass
else:
    # Do nothing for the "Cancel" button press
    return
ubiquibacon
  • 10,451
  • 28
  • 109
  • 179