Hi, guys
I’m new to both Python and to wxPython especially, so don’t judge too strongly.
Anyway, I’m trying to get used to Python GUI stuff and have trouble with refreshing ListCtrl (I’ve not used ObjectListView yet, if you suggest I may try. I tried to start simple).
I need to refill the content of a ListCtrl in the app.
Currently I’m doing it in a [probably stupid] way like
self.mailListControl.DeleteAllItems()
for email in messages:
listItemIndex = self.mailListControl.InsertItem(
self.mailListControl.GetItemCount(),
email.accountName)
self.mailListControl.SetItem(listItemIndex, 1, email.sender)
# more column filling here
self.mailListControl.SetItem(listItemIndex, 6, email.uidl)
self.mailListControl.SetItemData(listItemIndex, email.accountId)
The main reason is for doing it this way was I’m not familiar w/a better way and thought it should work fine. Mostly because every time the list needs to be refreshed it may contain different data and also different number of rows (sometimes no rows at all).
The problem is the app simply hangs in the middle of the loop (and I have to kill the process completely) and sometimes it even crashes with segmentation fault/core dump.
I kind of half-confident about the location where it happens in the code because it always happens when I know the app is supposed to refresh the list and also debug prints stop (I removed them from the sample above) in the middle of the loop as well.
Do you know if it may be an issue with the control or I’m not supposed to update the contents of it this way?
Thanks.