Python的高效图像缩略图控制?

3

如何选择最合适的Python GUI应用程序来显示大量缩略图,例如10000个或更多?为了提高性能,这种缩略图控件必须支持虚拟项,即仅请求用户当前可见的缩略图。

3个回答

2
wxPython中,您可以使用wxGrid,因为它支持虚拟模式和自定义单元格渲染器。 是您必须实现的wxGrid“数据提供程序”的最小接口:
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

这是你必须实现的wxGrid单元格渲染器的最小接口:
class CellRenderer(wx.grid.PyGridCellRenderer):
    def Draw(self, grid, attr, dc, rect, row, col, isSelected):
        pass

您可以在wxPython文档和演示中找到一个使用这些类的工作示例,它被称为Grid_MegaExample。

1

仅为完整起见:有一个thumbnailCtrl是用wxPython编写的,这可能是一个很好的起点。


1

1
如果您对PIL感到满意,请务必查看Pillow - gdvalderrama

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接