I’m experiencing a strange issue with the DataViewTreeCtrl where if I have over ~2500 items with icons it crashes. In my program theres about a dozen different icons, and when I reach the limit it just stops rendering the tree properly. However I can reproduce it in a test with only one icon and actually make it crash. Seems like I can have 100k items no problem if I don’t assign the image list.
import wx
import wx.dataview as dv
class MyFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, wx.ID_ANY, title, size=(400, 800))
il = wx.ImageList(16, 16)
il.Add(wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_OTHER, (16, 16)))
tree = dv.DataViewTreeCtrl(self)
tree.AssignImageList(il)
for d in range(3):
itemd = tree.AppendContainer(dv.NullDataViewItem, 'dddddddd', 0)
for c in range(10):
itemc = tree.AppendContainer(itemd, 'cccccccc', 0)
for b in range(10):
itemb = tree.AppendContainer(itemc, 'bbbbbbbbbbb', 0)
for a in range(10):
itema = tree.AppendItem(itemb, 'aaaaaaaaaaaaa', 0)
app = wx.App()
frame = MyFrame(None, ‘wx.lib.buttons Test’)
frame.Show()
app.MainLoop()
``
Any thoughts on how to get around this or what might be happening?
The problem here is that windows has an absolute limit on the number
of GUI elements that can exist at any one time. The work around is
a) Use Virtual Mode for your list and b) only create those icons
needed for those items on view, (and possibly those most likely to
be on view next), c) delete those out of the view. The good news is
that while you will have some more work to do on each view change
you will be amazed at the improved responsiveness of the GUI due to
the resource reductions.
Gadget/Steve
the DataViewTreeCtrl where if I have over ~2500 items with icons
it crashes. In my program theres about a dozen different icons,
and when I reach the limit it just stops rendering the tree
properly. However I can reproduce it in a test with only one
icon and actually make it crash. Seems like I can have 100k
items no problem if I don’t assign the image list.
I’ve been using HyperTreeList (not using icons in it though) and recently started having a few thousand items show up every once in a while, which REALLY slowed the GUI down to basically locked-up/frozen looking during loading and between scrolling up and down.
I was able to download this file and simply replace the imports for HyperTreeList with it (which essentially virtualized the tree list, I think, I haven’t read the code much) and my GUI is about 100X faster with tons of items:
On Tuesday, September 9, 2014 3:54:59 PM UTC-7, iamt...@gmail.com wrote:
I’m experiencing a strange issue with the DataViewTreeCtrl where if I have over ~2500 items with icons it crashes. In my program theres about a dozen different icons, and when I reach the limit it just stops rendering the tree properly. However I can reproduce it in a test with only one icon and actually make it crash. Seems like I can have 100k items no problem if I don’t assign the image list.
Thanks for the reply. HyperTreeList just on its own seem to work well, even with 100k icon items. Unfortunately it doesn’t seem to be cross platform which is a requirement for me.
···
On Wednesday, September 10, 2014 12:44:07 PM UTC-4, Nathan McCorkle wrote:
On Tuesday, September 9, 2014 3:54:59 PM UTC-7, iamt...@gmail.com wrote:
I’m experiencing a strange issue with the DataViewTreeCtrl where if I have over ~2500 items with icons it crashes. In my program theres about a dozen different icons, and when I reach the limit it just stops rendering the tree properly. However I can reproduce it in a test with only one icon and actually make it crash. Seems like I can have 100k items no problem if I don’t assign the image list.
I’ve been using HyperTreeList (not using icons in it though) and recently started having a few thousand items show up every once in a while, which REALLY slowed the GUI down to basically locked-up/frozen looking during loading and between scrolling up and down.
I was able to download this file and simply replace the imports for HyperTreeList with it (which essentially virtualized the tree list, I think, I haven’t read the code much) and my GUI is about 100X faster with tons of items:
So upon looking into how to virtualize a tree, I found the VirtualTree which uses the generic wx.TreeCtrl. I originally had used DataViewTreeCtrl because I assumed it was more performant, so I changed my example to use wx.TreeCtrl just to see what it could handle. I was able to add 1,000,000 icon items, all expanded, no issue whatsoever.
Seems to me like there is some sort of bug in DataViewTreeCtrl, as the generic implementation severely outperforms it.
···
On Wednesday, September 10, 2014 12:56:43 AM UTC-4, Gadget Steve wrote:
the DataViewTreeCtrl where if I have over ~2500 items with icons
it crashes. In my program theres about a dozen different icons,
and when I reach the limit it just stops rendering the tree
properly. However I can reproduce it in a test with only one
icon and actually make it crash. Seems like I can have 100k
items no problem if I don’t assign the image list.
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
The problem here is that windows has an absolute limit on the number
of GUI elements that can exist at any one time. The work around is
a) Use Virtual Mode for your list and b) only create those icons
needed for those items on view, (and possibly those most likely to
be on view next), c) delete those out of the view. The good news is
that while you will have some more work to do on each view change
you will be amazed at the improved responsiveness of the GUI due to
the resource reductions.
Thanks for the reply. HyperTreeList just on its own seem to work well, even with 100k icon items. Unfortunately it doesn't seem to be cross platform which is a requirement for me.
HyperTreeList is writen in Python, so it should really be cross platform. Andrea who developed it works only on Windows, so can't test on the other platforms but in the past he always accepted patches to make a control work on other platforms or helped in figuring out how to make it work.
Thanks for the reply. HyperTreeList just on its own seem to work well, even with 100k icon items. Unfortunately it doesn’t seem to be cross platform which is a requirement for me.
Hi,
HyperTreeList is writen in Python, so it should really be cross platform. Andrea who developed it works only on Windows, so can’t test on the other platforms but in the past he always accepted patches to make a control work on other platforms or helped in figuring out how to make it work.
Werner is perfectly right. In any case, I have reports of HypeTreeList working on all platforms supported by wxPython, so that should be good enough to get the OP started.
Werner is perfectly right. In any case, I have reports of HypeTreeList working on all platforms supported by wxPython, so that should be good enough to get the OP started.
Maybe update the 'Supported Platforms' section of the doc, in case that made the OP think that it is not cross platform.
Yea, when I saw a screenshot of it for windows and a big question mark for Gtk and OSX, I just assumed it was unsupported. However I think I’ve seen other components that explicitly said they were Windows only, so the assumption was a little silly in hindsight.
I’ve ended up using the generic TreeCtrl, but now that I know his work is portable, I’m definitely going to make use of the FlatNoteBook. Thanks for all the help.
···
On Thursday, September 11, 2014 2:17:46 AM UTC-4, werner wrote:
Hi Andrea,
On 9/11/2014 8:14, Andrea Gavana wrote:
…
Werner is perfectly right. In any case, I have reports of HypeTreeList
working on all platforms supported by wxPython, so that should be good
enough to get the OP started.
Maybe update the ‘Supported Platforms’ section of the doc, in case that
made the OP think that it is not cross platform.