Why isn’t EVT_CLOSE fired when I click the OK or Cancel buttons in a wx.Dialog?

When you click the Ok or Cancel buttons on a modal dialog the dialog is not closed with Close, instead it is ended with EndModal so the EVT_CLOSE event is not sent. Code that needs to run when a modal dialog is completed normally is usually put after the call to ShowModal. I think in this case that the documentation is incorrect.

OTOH, if the dialog is shown modeless (with Show instead of ShowModal) then they should be closed with Close and you will get the EVT_CLOSE event.