开发者

Efficient method for a grid of clickable images in wxPython?

Which is the most efficient method to display a grid of about 1000 clickable images in wxPython ?

Currently i am using a GridSizer filled with StaticBitmap objects. But its quite slow for 500+ images.

One more thing is that, i have a listbox of categories on the left. Tha开发者_Python百科t is to filter the images. Categories will be like "All", "Cat 1", "Cat 2" etc. When i click "All", all the image have to be displayed.

How i am doing this currently :

  • A VERTICAL BoxSizer will contain n GridSizer objects, one for each category. I add the StaticBitmap objects to multiple GridSizers depending on the categories it belongs to.
  • Then i display only that GridSizer depending on which category is selected

This method is also terribly slow for anything over 300 images. So, how do i achieve the same effect efficiently ?

.


I'm assuming that not all 1000 images are onscreen at the same time, correct? If so, you should be able to just load up the number you need and when the user scrolls, load up the next set as needed. I think the people on the wxPython list usually used DCs to blit their images onscreen or they use the FloatCanvas widget. I would recommend asking over on their list where there are a number of experts on drawing images onscreen: https://groups.google.com/forum/#!forum/wxpython-users


I would think a ListCtrl in ICON style would be the best way to do this.

If you look at the wxPython Demos, the UltimateListCtrl sample in the wx.LC_ICON style is a good example of what you could create.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜