Slow ListCtrl.SetStringItem

Hi,

i have a problem which i think should be solvable, but i can't find how to do it. I have a ListCtrl with 14 Cols and about 2000 rows. Getting and displaying this number is a problem tough: i have to call 14*2000 times SetStringItem and python function calls are very, very slow (It takes 6 seconds to fill the Box, without the calls to SetStringItem everything else takes < .5 s (using cProfile, Python 2.5).

I tried using VirtualLists which really makes things way faster, but the price is that i can no longer order (sort) my lists since the column headers are not clickable. i found this receipt http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/426407, but this "workaround" doesn't work on native mac os x listctrls.

Now what to do? I suggest a function that can set all labels for an entire row in a ListCtrl in one call. Is there already now a better way to fill a long list that should stay sortable?

Please CC since i'm not on the list.

Greetings,
Holger

Holger Rapp wrote:

Hi,

i have a problem which i think should be solvable, but i can't find how to do it. I have a ListCtrl with 14 Cols and about 2000 rows. Getting and displaying this number is a problem tough: i have to call 14*2000 times SetStringItem and python function calls are very, very slow (It takes 6 seconds to fill the Box, without the calls to SetStringItem everything else takes < .5 s (using cProfile, Python 2.5).

I tried using VirtualLists which really makes things way faster, but the price is that i can no longer order (sort) my lists since the column headers are not clickable.

What makes you think the headers are not clickable? EVT_LIST_COL_CLICK works fine with virtual lists. You can catch that and then do whatever is needed to reorder your data, and then call RefreshItems to redraw the items that are visible.

Please CC since i'm not on the list.

Please join the list. :wink:

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!