Python Forum

Full Version: Return code when closing the dialog
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
There is own dialogue which is inherited from wx.Dialog.

There is one button:

button_ok = wx.Button (self, wx.ID_OK, "OK")
Buttons with identifier wx.ID_CANCEL no.

Why, when I close the dialog through "X", then the return code is wx.ID_OK? Shouldn't I get wx.ID_CANCEL?
Respond to the EVT_CLOSE event and SetReturnCode(wx.ID_CANCEL) in that event handler. Also, return codes are usually associated with a modal dialog so for best behavior call the dialog with ShowModal()