ThumbnailCtrl is a widget that can be used to display a series of images in a “thumbnail” format.
ThumbnailCtrl is a widget that can be used to display a series of images in a “thumbnail” format; it mimics, for example, the windows explorer behavior when you select the “view thumbnails” option. Basically, by specifying a folder that contains some image files, the files in the folder are displayed as miniature versions of the actual images in a wx.ScrolledWindow.
The code is partly based on wxVillaLib, a wxWidgets implementation of this control. However, ThumbnailCtrl wouldn’t have been so fast and complete without the suggestions and hints from Peter Damoc. So, if he accepts the mention, this control is his as much as mine.
Usage example:
import os
import wx
import wx.lib.agw.thumbnailctrl as TC
class MyFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "ThumbnailCtrl Demo")
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
thumbnail = TC.ThumbnailCtrl(panel, imagehandler=TC.NativeImageHandler)
sizer.Add(thumbnail, 1, wx.EXPAND | wx.ALL, 10)
thumbnail.ShowDir(os.getcwd())
panel.SetSizer(sizer)
# our normal wxApp-derived class, as usual
app = wx.PySimpleApp()
frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()
This code snippet can be downloaded, see this example script.
Note
Some of the AGW snippets of code in the documentation use images and external files (to create bitmaps or access external data). As these files are not provided in these snippets, you should make the approriate modifications to the code to actually run it.
With ThumbnailCtrl you can:
Note
Using highlight thumbnails on mouse hovering may be slow on slower computers.
This class processes the following events:
Event Name | Description |
---|---|
EVT_THUMBNAILS_CAPTION_CHANGED | The thumbnail caption has been changed. Not used at present. |
EVT_THUMBNAILS_DCLICK | The user has double-clicked on a thumbnail. |
EVT_THUMBNAILS_POINTED | The mouse cursor is hovering over a thumbnail. |
EVT_THUMBNAILS_SEL_CHANGED | The user has changed the selected thumbnail. |
EVT_THUMBNAILS_THUMB_CHANGED | The thumbnail of an image has changed. Used internally. |
ThumbnailCtrl is distributed under the wxPython license.
Latest revision: Andrea Gavana @ 17 Aug 2011, 15.00 GMT
Version 0.9
Module author: Andrea Gavana <andrea.gavana@gmail.com>
A graphical representation of the SVN commits in the last year.
Click on any date in the picture to jump to that particular revision page, containing information about committers, log messages and SVN diffs.
Revision Graph For thumbnailctrl