'How to create a MessageDialog with buttons diffrent than YES and No?

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?



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ubiquibacon