debug.py (6.3 KB)
Hi all,
I have two DataViewCtrl work fine with PyDataViewModel. (in wxpython 4.0.6)
What I want to do is moving some items from one control to another and then select them.
As the codes below, however, the call of self.dvc2.SetSelections(to_select) always make my program crashed.
Is it correct to use DataViewItemArray like this way? Any help would be much appreciated.
Thanks ckkart,
You are right, the crashed problem is solved with the updated code: debug.py (6.3 KB)
However, another problem arises, the result of selection seems to be a mess.
I suspect if it is safe to call the function ObjectToItem() in my button handler, because the description in document seems to create ‘new’ DataViewItem:
ObjectToItem : Create a DataViewItem for the object, and remember the ID-.obj mapping.
But i cannot figure out other way to retrieve these DataViewItems and pass them to SetSelections().
Yes, i used the code i uploaded above without any change (in win10, wxpython 4.0.6, python 3.6.4)
I ran it many times to see the results. Although the selection is correct once or twice, most times it give me the wrong outcome.
Hi ckkart,
It is so nice to hear about that.
I tested it today, and it works perfectly only after updating to wxpython 4.1.0.
All problems have been solved, I really appreciate your kindly effort and notice.