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 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.App(0)
frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()
With ThumbnailCtrl
you can:
Ctrl
key + mouse wheel or with +
and -
chars,
with zoom factor value customizable);d
key rotates 90 degrees clockwise;s
key rotates 90 degrees counter-clockwise;a
key rotates 180 degrees.del
key);ThumbnailCtrl
to whatever application you want;ComboBox
at the top of ThumbnailCtrl
: this combobox contains
working directory information and it has history entries;Note
Using highlight thumbnails on mouse hovering may be slow on slower computers.
No particular window styles are available for this class.
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 @ 27 Dec 2012, 21.00 GMT
Version 0.9
getDataBL |
Return the second part of the shadow dropped behind thumbnails. |
getDataSH |
Return the first part of the shadow dropped behind thumbnails. |
getDataTR |
Return the third part of the shadow dropped behind thumbnails. |
GetMondrianBitmap |
Returns a default image placeholder as a wx.Bitmap . |
GetMondrianData |
Returns a default image placeholder as a decompressed stream of characters. |
GetMondrianImage |
Returns a default image placeholder as a wx.Image . |
getShadow |
Creates a shadow behind every thumbnail. |
KeyThumb |
Return the key to be used for sorting??? |
opj |
Convert paths to the platform-specific separator. |
SortFiles |
Sort files in alphabetical order. |
NativeImageHandler |
This image handler loads and manipulates the thumbnails with the help of |
PILImageHandler |
This image handler loads and manipulates the thumbnails with the help |
ScrolledThumbnail |
This is the main class implementation of ThumbnailCtrl . |
Thumb |
This is an auxiliary class, to handle single thumbnail information for every thumb. |
ThumbnailCtrl |
ThumbnailCtrl is a widget that can be used to display a series of images in |
ThumbnailEvent |
This class is used to send events when a thumbnail is hovered, selected, |
getDataBL
()¶Return the second part of the shadow dropped behind thumbnails.
getDataSH
()¶Return the first part of the shadow dropped behind thumbnails.
getDataTR
()¶Return the third part of the shadow dropped behind thumbnails.
GetMondrianData
()¶Returns a default image placeholder as a decompressed stream of characters.
getShadow
()¶Creates a shadow behind every thumbnail.
KeyThumb
(item)¶Return the key to be used for sorting???
opj
(path)¶Convert paths to the platform-specific separator.
Parameters: | path – the path to convert. |
---|