Ensure the notebook still exists as the delivery of the changed and changing events may not happen right away

This commit is contained in:
Robin Dunn
2017-04-20 15:41:59 -07:00
parent 242e054552
commit c688587c0a

View File

@@ -85,6 +85,7 @@ class TestNB(wx.Notebook):
def OnPageChanged(self, event):
if self:
old = event.GetOldSelection()
new = event.GetSelection()
sel = self.GetSelection()
@@ -92,6 +93,7 @@ class TestNB(wx.Notebook):
event.Skip()
def OnPageChanging(self, event):
if self:
old = event.GetOldSelection()
new = event.GetSelection()
sel = self.GetSelection()