.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. currentmodule:: wx.lib.agw.scrolledthumbnail .. highlight:: python .. _wx.lib.agw.scrolledthumbnail.ScrolledThumbnail: ========================================================================================================================================== |phoenix_title| **wx.lib.agw.scrolledthumbnail.ScrolledThumbnail** ========================================================================================================================================== This is the main class implementation of :class:`ThumbnailCtrl`. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class ScrolledThumbnail:
| |super_classes| Known Superclasses ================================== :class:`wx.ScrolledWindow` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.__init__` Default class constructor. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.CalculateBestCaption` Calculates the best caption string to show based on the actual zoom factor. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.Clear` Clears :class:`ThumbnailCtrl`. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.DrawThumbnail` Draws a visible thumbnail. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.EnableDragging` Enables/disables thumbnails drag and drop. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.EnableToolTips` Globally enables/disables thumbnail file information. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetCaptionFont` Returns the font for all the thumbnail captions. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetCaptionHeight` Returns the height for the file name caption. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetDropShadow` Returns whether to drop a shadow behind thumbnails or not. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetGlobalPopupMenu` Returns the global thumbnailss popup menu (no need of thumbnail selection). :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetHighlightPointed` Returns whether the thumbnail pointed should be highlighted or not. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetItem` Return thumbnail at specified position. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetItemCount` Returns the number of thumbnails. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetItemIndex` Returns the thumbnail index at position (x, y). :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetPaintRect` Returns the paint bounding rect for the :meth:`~ScrolledThumbnail.OnPaint` method. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetPointed` Returns the pointed thumbnail index. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetPointedItem` Returns the pointed thumbnail. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetPopupMenu` Returns the thumbnails popup menu when at least one thumbnail is selected. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetSelectedItem` Returns the selected thumbnail. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetSelection` Returns the selected thumbnail. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetSelectionColour` Returns the colour used to indicate a selected thumbnail. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetThumbBorder` Returns the thumbnail border. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetThumbHeight` Returns the thumbnail height. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetThumbInfo` Returns the thumbnail information. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetThumbOutline` Returns the thumbnail outline style on selection. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetThumbSize` Returns the thumbnail size as width, height and border. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetThumbWidth` Returns the thumbnail width. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.GetZoomFactor` Returns the zoom factor. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.InsertItem` Inserts a thumbnail in the specified position. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.IsSelected` Returns whether a thumbnail is selected or not. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.LoadImages` Threaded method to load images. Used internally. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.OnChar` Handles the ``wx.EVT_CHAR`` event for :class:`ThumbnailCtrl`. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.OnMouseDClick` Handles the ``wx.EVT_LEFT_DCLICK`` event for :class:`ThumbnailCtrl`. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.OnMouseDown` Handles the ``wx.EVT_LEFT_DOWN`` and ``wx.EVT_RIGHT_DOWN`` events for :class:`ThumbnailCtrl`. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.OnMouseLeave` Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`ThumbnailCtrl`. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.OnMouseMove` Handles the ``wx.EVT_MOTION`` event for :class:`ThumbnailCtrl`. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.OnMouseUp` Handles the ``wx.EVT_LEFT_UP`` and ``wx.EVT_RIGHT_UP`` events for :class:`ThumbnailCtrl`. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.OnMouseWheel` Handles the ``wx.EVT_MOUSEWHEEL`` event for :class:`ThumbnailCtrl`. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.OnPaint` Handles the ``wx.EVT_PAINT`` event for :class:`ThumbnailCtrl`. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.OnResize` Handles the ``wx.EVT_SIZE`` event for :class:`ThumbnailCtrl`. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.OnThumbChanged` Handles the ``EVT_THUMBNAILS_THUMB_CHANGED`` event for :class:`ThumbnailCtrl`. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.RemoveItemAt` Removes a thumbnail at the specified position. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.Rotate` Rotates the selected thumbnails by the angle specified by `angle`. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.ScrollToSelected` Scrolls the :class:`ScrolledWindow` to the selected thumbnail. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.SetCaptionFont` Sets the font for all the thumbnail captions. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.SetDropShadow` Sets whether to drop a shadow behind thumbnails or not. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.SetGlobalPopupMenu` Sets the global thumbnails popup menu (no need of thumbnail selection). :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.SetHighlightPointed` Sets whether the thumbnail pointed should be highlighted or not. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.SetPopupMenu` Sets the thumbnails popup menu when at least one thumbnail is selected. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.SetSelection` Sets thumbnail selection. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.SetSelectionColour` Sets the colour used to indicate a selected thumbnail. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.SetThumbOutline` Sets the thumbnail outline style on selection. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.SetThumbSize` Sets the thumbnail size as width, height and border. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.SetZoomFactor` Sets the zoom factor. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.ShowFileNames` Sets whether the user wants to show file names under the thumbnails or not. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.ShowThumbs` Shows all the thumbnails. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.ThreadImage` Threaded method to load images. Used internally. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.UpdateItems` Updates thumbnail items. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.UpdateProp` Updates :class:`ThumbnailCtrl` and its visible thumbnails. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.UpdateShow` Updates thumbnail items. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.ZoomIn` Zooms the thumbnails in. :meth:`~wx.lib.agw.scrolledthumbnail.ScrolledThumbnail.ZoomOut` Zooms the thumbnails out. ================================================================================ ================================================================================ | |api| Class API =============== .. class:: ScrolledThumbnail(wx.ScrolledWindow) This is the main class implementation of :class:`ThumbnailCtrl`. .. method:: __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, thumboutline=THUMB_OUTLINE_IMAGE, imagehandler=None) Default class constructor. :param `parent`: parent window. Must not be ``None``; :param `id`: window identifier. A value of -1 indicates a default value; :param `pos`: the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform; :param `size`: the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform; :param `thumboutline`: outline style for :class:`ScrolledThumbnail`, which may be: =========================== ======= ================================== Outline Flag Value Description =========================== ======= ================================== ``THUMB_OUTLINE_NONE`` 0 No outline is drawn on selection ``THUMB_OUTLINE_FULL`` 1 Full outline (image+caption) is drawn on selection ``THUMB_OUTLINE_RECT`` 2 Only thumbnail bounding rectangle is drawn on selection (default) ``THUMB_OUTLINE_IMAGE`` 4 Only image bounding rectangle is drawn. =========================== ======= ================================== :param `imagehandler`: can be :class:`PILImageHandler` if PIL is installed (faster), or :class:`NativeImageHandler` which only uses wxPython image methods. .. method:: CalculateBestCaption(self, dc, caption, sw, width) Calculates the best caption string to show based on the actual zoom factor. :param `dc`: an instance of :class:`wx.DC`; :param `caption`: the original caption string; :param `sw`: the maximum width allowed for the caption string, in pixels; :param `width`: the caption string width, in pixels. .. method:: Clear(self) Clears :class:`ThumbnailCtrl`. .. method:: DrawThumbnail(self, bmp, thumb, index) Draws a visible thumbnail. :param `bmp`: the thumbnail version of the original image; :param `thumb`: an instance of :class:`Thumb`; :param `index`: the index of the thumbnail to draw. .. method:: EnableDragging(self, enable=True) Enables/disables thumbnails drag and drop. :param `enable`: ``True`` to enable drag and drop, ``False`` to disable it. .. method:: EnableToolTips(self, enable=True) Globally enables/disables thumbnail file information. :param `enable`: ``True`` to enable thumbnail file information, ``False`` to disable it. .. method:: GetCaptionFont(self) Returns the font for all the thumbnail captions. .. method:: GetCaptionHeight(self, begRow, count=1) Returns the height for the file name caption. :param `begRow`: the caption line at which we start measuring the height; :param `count`: the number of lines to measure. .. method:: GetDropShadow(self) Returns whether to drop a shadow behind thumbnails or not. .. method:: GetGlobalPopupMenu(self) Returns the global thumbnailss popup menu (no need of thumbnail selection). .. method:: GetHighlightPointed(self) Returns whether the thumbnail pointed should be highlighted or not. .. note:: Please be aware that this functionality may be slow on slower computers. .. method:: GetItem(self, pos) Return thumbnail at specified position. :param pos: the index of the thumbnail :return: the Thumb .. method:: GetItemCount(self) Returns the number of thumbnails. .. method:: GetItemIndex(self, x, y) Returns the thumbnail index at position (x, y). :param `x`: the mouse `x` position; :param `y`: the mouse `y` position. .. method:: GetPaintRect(self) Returns the paint bounding rect for the :meth:`~ScrolledThumbnail.OnPaint` method. .. method:: GetPointed(self) Returns the pointed thumbnail index. .. method:: GetPointedItem(self) Returns the pointed thumbnail. .. method:: GetPopupMenu(self) Returns the thumbnails popup menu when at least one thumbnail is selected. .. method:: GetSelectedItem(self, index) Returns the selected thumbnail. :param `index`: the thumbnail index (i.e., the selection). .. method:: GetSelection(self, selIndex=-1) Returns the selected thumbnail. :param `selIndex`: if not equal to -1, the index of the selected thumbnail. .. method:: GetSelectionColour(self) Returns the colour used to indicate a selected thumbnail. .. method:: GetThumbBorder(self) Returns the thumbnail border. .. method:: GetThumbHeight(self) Returns the thumbnail height. .. method:: GetThumbInfo(self, thumb=-1) Returns the thumbnail information. :param `thumb`: the index of the thumbnail for which we are collecting information. .. method:: GetThumbOutline(self) Returns the thumbnail outline style on selection. .. seealso:: :meth:`~ScrolledThumbnail.SetThumbOutline` for a list of possible return values. .. method:: GetThumbSize(self) Returns the thumbnail size as width, height and border. .. method:: GetThumbWidth(self) Returns the thumbnail width. .. method:: GetZoomFactor(self) Returns the zoom factor. .. method:: InsertItem(self, thumb, pos) Inserts a thumbnail in the specified position. :param `pos`: the index at which we wish to insert the new thumbnail. .. method:: IsSelected(self, indx) Returns whether a thumbnail is selected or not. :param `indx`: the index of the thumbnail to check for selection. .. method:: LoadImages(self, newfile, imagecount) Threaded method to load images. Used internally. :param `newfile`: a file name containing an image to thumbnail; :param `imagecount`: the number of images loaded until now. .. method:: OnChar(self, event) Handles the ``wx.EVT_CHAR`` event for :class:`ThumbnailCtrl`. :param `event`: a :class:`KeyEvent` event to be processed. .. note:: You have these choices: (1) ``d`` key rotates 90 degrees clockwise the selected thumbnails; (2) ``s`` key rotates 90 degrees counter-clockwise the selected thumbnails; (3) ``a`` key rotates 180 degrees the selected thumbnails; (4) ``+`` key zooms in; (5) ``-`` key zooms out. All other keys cause an EVT_THUMBNAILS_CHAR event to be thrown. .. method:: OnMouseDClick(self, event) Handles the ``wx.EVT_LEFT_DCLICK`` event for :class:`ThumbnailCtrl`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnMouseDown(self, event) Handles the ``wx.EVT_LEFT_DOWN`` and ``wx.EVT_RIGHT_DOWN`` events for :class:`ThumbnailCtrl`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnMouseLeave(self, event) Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`ThumbnailCtrl`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnMouseMove(self, event) Handles the ``wx.EVT_MOTION`` event for :class:`ThumbnailCtrl`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnMouseUp(self, event) Handles the ``wx.EVT_LEFT_UP`` and ``wx.EVT_RIGHT_UP`` events for :class:`ThumbnailCtrl`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnMouseWheel(self, event) Handles the ``wx.EVT_MOUSEWHEEL`` event for :class:`ThumbnailCtrl`. :param `event`: a :class:`MouseEvent` event to be processed. .. note:: If you hold down the ``Ctrl`` key, you can zoom in/out with the mouse wheel. .. method:: OnPaint(self, event) Handles the ``wx.EVT_PAINT`` event for :class:`ThumbnailCtrl`. :param `event`: a :class:`PaintEvent` event to be processed. .. method:: OnResize(self, event) Handles the ``wx.EVT_SIZE`` event for :class:`ThumbnailCtrl`. :param `event`: a :class:`wx.SizeEvent` event to be processed. .. method:: OnThumbChanged(self, event) Handles the ``EVT_THUMBNAILS_THUMB_CHANGED`` event for :class:`ThumbnailCtrl`. :param `event`: a :class:`ThumbnailEvent` event to be processed. .. method:: RemoveItemAt(self, pos) Removes a thumbnail at the specified position. :param `pos`: the index at which we wish to remove the thumbnail. .. method:: Rotate(self, angle=90) Rotates the selected thumbnails by the angle specified by `angle`. :param `angle`: the rotation angle for the thumbnail, in degrees. .. method:: ScrollToSelected(self) Scrolls the :class:`ScrolledWindow` to the selected thumbnail. .. method:: SetCaptionFont(self, font=None) Sets the font for all the thumbnail captions. :param `font`: a valid :class:`wx.Font` object. If defaulted to ``None``, a standard font will be generated. .. method:: SetDropShadow(self, drop) Sets whether to drop a shadow behind thumbnails or not. :param `drop`: ``True`` to drop a shadow behind each thumbnail, ``False`` otheriwise. .. method:: SetGlobalPopupMenu(self, gpmenu) Sets the global thumbnails popup menu (no need of thumbnail selection). :param `gpmenu`: an instance of :class:`wx.Menu`. .. method:: SetHighlightPointed(self, highlight=True) Sets whether the thumbnail pointed should be highlighted or not. :param `highlight`: ``True`` to enable highlight-on-point with the mouse, ``False`` otherwise. .. note:: Please be aware that this functionality may be slow on slower computers. .. method:: SetPopupMenu(self, menu) Sets the thumbnails popup menu when at least one thumbnail is selected. :param `menu`: an instance of :class:`wx.Menu`. .. method:: SetSelection(self, value=-1) Sets thumbnail selection. :param `value`: the thumbnail index to select. .. method:: SetSelectionColour(self, colour=None) Sets the colour used to indicate a selected thumbnail. :param `colour`: a valid :class:`wx.Colour` object. If defaulted to ``None``, it will be taken from the system settings. .. method:: SetThumbOutline(self, outline) Sets the thumbnail outline style on selection. :param `outline`: the outline to use on selection. This can be one of the following bits: =========================== ======= ================================== Outline Flag Value Description =========================== ======= ================================== ``THUMB_OUTLINE_NONE`` 0 No outline is drawn on selection ``THUMB_OUTLINE_FULL`` 1 Full outline (image+caption) is drawn on selection ``THUMB_OUTLINE_RECT`` 2 Only thumbnail bounding rectangle is drawn on selection (default) ``THUMB_OUTLINE_IMAGE`` 4 Only image bounding rectangle is drawn. =========================== ======= ================================== .. method:: SetThumbSize(self, width, height, border=6) Sets the thumbnail size as width, height and border. :param `width`: the desired thumbnail width; :param `height`: the desired thumbnail height; :param `border`: the spacing between thumbnails. .. method:: SetZoomFactor(self, zoom=1.4) Sets the zoom factor. :param `zoom`: a floating point number representing the zoom factor. Must be greater than or equal to 1.0. .. method:: ShowFileNames(self, show=True) Sets whether the user wants to show file names under the thumbnails or not. :param `show`: ``True`` to show file names under the thumbnails, ``False`` otherwise. .. method:: ShowThumbs(self, thumbs) Shows all the thumbnails. :param `thumbs`: should be a sequence with instances of :class:`Thumb`; .. method:: ThreadImage(self, filenames) Threaded method to load images. Used internally. :param `filenames`: a Python list of file names containing images. .. method:: UpdateItems(self) Updates thumbnail items. .. method:: UpdateProp(self, checkSize=True) Updates :class:`ThumbnailCtrl` and its visible thumbnails. :param `checkSize`: ``True`` to update the items visibility if the window size has changed. .. method:: UpdateShow(self) Updates thumbnail items. .. method:: ZoomIn(self) Zooms the thumbnails in. .. method:: ZoomOut(self) Zooms the thumbnails out.