Reputation: 59333
I'm binding the EVT_AUINOTEBOOK_PAGE_CHANGE
event to the AuiNotebook
successfully, but EVT_AUINOTEBOOK_PAGE_CLOSE
and EVT_AUINOTEBOOK_PAGE_CLOSED
both do nothing. The bound handler is never run. My construction and binding code looks like this:
self.notebook = wx.aui.AuiNotebook(self)
self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.on_page_close)
self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.on_page_changed)
And my event handler simply looks like this:
def on_page_close(self, event):
print 'Page closed', event
Why don't the page close events do anything?
Just in case, here is the full source file with the relevant lines highlighted.
Upvotes: 0
Views: 289
Reputation: 59333
The close events are not triggered when pages are removed using DeletePage
or RemovePage
, only when they are closed using the little close buttons. There are no methods for programmatically closing a page that will trigger the page close events, so what ever on-close routines you want to perform, you have to put them in a separate function and call them both from the close event handler and from all the functions that invoke RemovePage
or DeletePage
.
Upvotes: 1