At the risk or raising the dead… I’m now trying to do this for the same reasons. Is there a method people are using to avoid this problem entirely or could someone point to a code snippet that shows how to create a DataViewItemArray?
Thanks,
···
On Thursday, 22 January 2015 02:10:31 UTC, zliwang wrote:
Hi
Can someone let me know how to construct a DataViewItemArray and use it inItemsAdded(parent, items)?
On Linux, calling Cleared() does not cause the control to automatically reread the data so I have to call
ItemAdded or ItemsAdded explicitly (Sigh). But if I call ItemAdded repeatedly to add several items under
dv.NullDataViewItem things won’t work. Only the first one Added shows up properly. So I think I should use
ItemsAdded(dv.NullDataViewItem, items). But I could not figure out how to build the parameter ‘items’, which is a DataViewItemArray.
DataViewModel ItemsAdded(self, parent, items)
Call this to inform the model that several items have been added to the data.
There is an example of adding items to a DataViewItemArray in demo/DVC_DataViewModel.py in the GetChildren method. It has an append method that works as expected. To create a new array you should be able to use its default constructor, like: dva = wx.dataview.DataViewItemArray()