views:

941

answers:

3

What is the best choice for a Python GUI application to display large number of thumbnails, e.g. 10000 or more? For performance reasons such thumbnail control must support virtual items, i.e. request application for those thumbnails only which are currently visible to user.

+1  A: 

If you had to resort to writing your own, I've had good results using the Python Imaging Library to create thumbnails in the past. http://www.pythonware.com/products/pil/

Tartley
+1  A: 

In wxPython you can use wxGrid for this as it supports virtual mode and custom cell renderers.

This is the minimal interface you have to implement for a wxGrid "data provider":

class GridData(wx.grid.PyGridTableBase):
    def GetColLabelValue(self, col):
        pass

    def GetNumberRows(self):
        pass

    def GetNumberCols(self):
        pass

    def IsEmptyCell(self, row, col):
        pass

    def GetValue(self, row, col):
        pass

This is the minimal interface you have to implement for a wxGrid cell renderer:

class CellRenderer(wx.grid.PyGridCellRenderer):
    def Draw(self, grid, attr, dc, rect, row, col, isSelected):
        pass

You can find a working example that utilizes these classes in wxPython docs and demos, it's called Grid_MegaExample.

Toni Ruža
+1  A: 

Just for completeness: there is a thumbnailCtrl written in/for wxPython, which might be a good starting point.

RSabet