diff --git a/demo/DVC_DataViewModel.py b/demo/DVC_DataViewModel.py index 1724ee50..6f4be022 100644 --- a/demo/DVC_DataViewModel.py +++ b/demo/DVC_DataViewModel.py @@ -245,11 +245,15 @@ class TestPanel(wx.Panel): # Create an instance of our model... if model is None: self.model = MyTreeListModel(data, log) + newModel = True # it's a new instance so we need to decref it below else: self.model = model + newModel = False # Tell the DVC to use the model self.dvc.AssociateModel(self.model) + if newModel: + self.model.DecRef() # Define the columns that we want in the view. Notice the # parameter which tells the view which column in the data model to pull diff --git a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.dataview.DataViewModel.2.py b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.dataview.DataViewModel.2.py index f41b8742..cd755cfb 100644 --- a/docs/sphinx/rest_substitutions/snippets/python/converted/wx.dataview.DataViewModel.2.py +++ b/docs/sphinx/rest_substitutions/snippets/python/converted/wx.dataview.DataViewModel.2.py @@ -1,6 +1,4 @@ - musicCtrl = wx.dataview.DataViewCtrl(self, wx.ID_ANY) - musicModel = MyMusicModel() - musicCtrl.AssociateModel(musicModel.get()) + ### wxPython does not provide wrappers for wxObjectDataPtr + - # add columns now