.. 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



.. _wx.richtext.RichTextImage:

==========================================================================================================================================
|phoenix_title|  **wx.richtext.RichTextImage**
==========================================================================================================================================

This class implements a graphic object.          







         



.. seealso:: :ref:`wx.richtext.RichTextBuffer`, :ref:`wx.richtext.RichTextCtrl`, :ref:`wx.richtext.RichTextImageBlock`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>RichTextImage</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.richtext.RichTextImage_inheritance.png" alt="Inheritance diagram of RichTextImage" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.richtext.RichTextImage.html" title="wx.richtext.RichTextImage" alt="" coords="6,160,201,189"/> <area shape="rect" id="node2" href="wx.richtext.RichTextObject.html" title="wx.richtext.RichTextObject" alt="" coords="5,83,201,112"/> <area shape="rect" id="node3" href="wx.Object.html" title="wx.Object" alt="" coords="60,5,147,35"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextImage.__init__`                                      Default constructor.
:meth:`~wx.richtext.RichTextImage.CanEditProperties`                             Returns ``True`` if we can edit the object's properties via a GUI.
:meth:`~wx.richtext.RichTextImage.Clone`                                         Clones the image object.
:meth:`~wx.richtext.RichTextImage.Copy`                                          Copies the image object.
:meth:`~wx.richtext.RichTextImage.Draw`                                          Draw the item, within the given range.
:meth:`~wx.richtext.RichTextImage.EditProperties`                                Edits the object's properties via a GUI.
:meth:`~wx.richtext.RichTextImage.GetImageBlock`                                 Returns the image block containing the raw data.
:meth:`~wx.richtext.RichTextImage.GetImageCache`                                 Returns the image cache (a scaled bitmap).
:meth:`~wx.richtext.RichTextImage.GetImageState`                                 Gets the image state.
:meth:`~wx.richtext.RichTextImage.GetNaturalSize`                                Returns the 'natural' size for this object - the image size.
:meth:`~wx.richtext.RichTextImage.GetOriginalImageSize`                          Gets the original image size.
:meth:`~wx.richtext.RichTextImage.GetPropertiesMenuLabel`                        Returns the label to be used for the properties context menu item.
:meth:`~wx.richtext.RichTextImage.GetRangeSize`                                  Returns the object size for the given range.
:meth:`~wx.richtext.RichTextImage.GetXMLNodeName`                                Returns the ``XML`` node name of this object.
:meth:`~wx.richtext.RichTextImage.ImportFromXML`                                 Imports this object from ``XML``.
:meth:`~wx.richtext.RichTextImage.IsEmpty`                                       Returns ``True`` if the object is empty.
:meth:`~wx.richtext.RichTextImage.IsFloatable`                                   Returns ``True`` if this class of object is floatable.
:meth:`~wx.richtext.RichTextImage.Layout`                                        Lay the item out at the specified position with the given size constraint.
:meth:`~wx.richtext.RichTextImage.LoadAndScaleImageCache`                        Do the loading and scaling.
:meth:`~wx.richtext.RichTextImage.LoadImageCache`                                Creates a cached image at the required size.
:meth:`~wx.richtext.RichTextImage.ResetImageCache`                               Resets the image cache.
:meth:`~wx.richtext.RichTextImage.SetImageCache`                                 Sets the image cache.
:meth:`~wx.richtext.RichTextImage.SetImageState`                                 Sets the image state.
:meth:`~wx.richtext.RichTextImage.SetOriginalImageSize`                          Sets the original image size.
:meth:`~wx.richtext.RichTextImage.UsesParagraphAttributes`                       Returns ``True`` if this object takes note of paragraph attributes (text and image objects don't).
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.richtext.RichTextImage.ImageBlock`                                    See :meth:`~wx.richtext.RichTextImage.GetImageBlock`
:attr:`~wx.richtext.RichTextImage.ImageCache`                                    See :meth:`~wx.richtext.RichTextImage.GetImageCache` and :meth:`~wx.richtext.RichTextImage.SetImageCache`
:attr:`~wx.richtext.RichTextImage.ImageState`                                    See :meth:`~wx.richtext.RichTextImage.GetImageState` and :meth:`~wx.richtext.RichTextImage.SetImageState`
:attr:`~wx.richtext.RichTextImage.NaturalSize`                                   See :meth:`~wx.richtext.RichTextImage.GetNaturalSize`
:attr:`~wx.richtext.RichTextImage.OriginalImageSize`                             See :meth:`~wx.richtext.RichTextImage.GetOriginalImageSize` and :meth:`~wx.richtext.RichTextImage.SetOriginalImageSize`
:attr:`~wx.richtext.RichTextImage.PropertiesMenuLabel`                           See :meth:`~wx.richtext.RichTextImage.GetPropertiesMenuLabel`
:attr:`~wx.richtext.RichTextImage.XMLNodeName`                                   See :meth:`~wx.richtext.RichTextImage.GetXMLNodeName`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.richtext.RichTextImage(RichTextObject)

   **Possible constructors**::

       RichTextImage(parent=None)
       
       RichTextImage(image, parent=None, charStyle=None)
       
       RichTextImage(imageBlock, parent=None, charStyle=None)
       
       RichTextImage(obj)
       
   
   This class implements a graphic object.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, parent=None)`
      
      Default constructor.                  
      
      
      :param `parent`: 
      :type `parent`: wx.richtext.RichTextObject
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, image, parent=None, charStyle=None)`
      
      Creates a :ref:`wx.richtext.RichTextImage`  from a :ref:`wx.Image`.                  
      
      
      :param `image`: 
      :type `image`: wx.Image
      :param `parent`: 
      :type `parent`: wx.richtext.RichTextObject
      :param `charStyle`: 
      :type `charStyle`: wx.richtext.RichTextAttr
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, imageBlock, parent=None, charStyle=None)`
      
      Creates a :ref:`wx.richtext.RichTextImage`  from an image block.                  
      
      
      :param `imageBlock`: 
      :type `imageBlock`: wx.richtext.RichTextImageBlock
      :param `parent`: 
      :type `parent`: wx.richtext.RichTextObject
      :param `charStyle`: 
      :type `charStyle`: wx.richtext.RichTextAttr
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, obj)`
      
      Copy constructor.                  
      
      
      :param `obj`: 
      :type `obj`: wx.richtext.RichTextImage
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: CanEditProperties(self)

      Returns ``True`` if we can edit the object's properties via a GUI.                  

      :rtype: `bool`








   .. method:: Clone(self)

      Clones the image object.                  

      :rtype: :ref:`wx.richtext.RichTextObject`








   .. method:: Copy(self, obj)

      Copies the image object.                  


      :param `obj`: 
      :type `obj`: wx.richtext.RichTextImage







   .. method:: Draw(self, dc, context, range, selection, rect, descent, style)

      Draw the item, within the given range.                  

      Some objects may ignore the range (for example paragraphs) while others must obey it (lines, to implement wrapping)                  


      :param `dc`: 
      :type `dc`: wx.DC
      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext
      :param `range`: 
      :type `range`: wx.richtext.RichTextRange
      :param `selection`: 
      :type `selection`: wx.richtext.RichTextSelection
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `descent`: 
      :type `descent`: int
      :param `style`: 
      :type `style`: int




      :rtype: `bool`








   .. method:: EditProperties(self, parent, buffer)

      Edits the object's properties via a GUI.                  


      :param `parent`: 
      :type `parent`: wx.Window
      :param `buffer`: 
      :type `buffer`: wx.richtext.RichTextBuffer




      :rtype: `bool`








   .. method:: GetImageBlock(self)

      Returns the image block containing the raw data.                  

      :rtype: :ref:`wx.richtext.RichTextImageBlock`








   .. method:: GetImageCache(self)

      Returns the image cache (a scaled bitmap).                  

      :rtype: :ref:`Bitmap`








   .. method:: GetImageState(self)

      Gets the image state.                  

      :rtype: `int`








   .. method:: GetNaturalSize(self)

      Returns the 'natural' size for this object - the image size.                  

      :rtype: :ref:`wx.richtext.TextAttrSize`








   .. method:: GetOriginalImageSize(self)

      Gets the original image size.                  

      :rtype: :ref:`Size`








   .. method:: GetPropertiesMenuLabel(self)

      Returns the label to be used for the properties context menu item.                  

      :rtype: `string`








   .. method:: GetRangeSize(self, range, size, descent, dc, context, flags, position=Point(0,0), parentSize=DefaultSize, partialExtents=None)

      Returns the object size for the given range.                  

      Returns ``False`` if the range is invalid for this object.                  


      :param `range`: 
      :type `range`: wx.richtext.RichTextRange
      :param `size`: 
      :type `size`: wx.Size
      :param `descent`: 
      :type `descent`: int
      :param `dc`: 
      :type `dc`: wx.DC
      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext
      :param `flags`: 
      :type `flags`: int
      :param `position`: 
      :type `position`: wx.Point
      :param `parentSize`: 
      :type `parentSize`: wx.Size
      :param `partialExtents`: 
      :type `partialExtents`: list of integers




      :rtype: `bool`








   .. method:: GetXMLNodeName(self)

      Returns the ``XML`` node name of this object.                  

      This must be overridden for XmlNode-base ``XML`` export to work.                  

      :rtype: `string`








   .. method:: ImportFromXML(self, buffer, node, handler, recurse)

      Imports this object from ``XML``.                  


      :param `buffer`: 
      :type `buffer`: wx.richtext.RichTextBuffer
      :param `node`: 
      :type `node`: wx.xml.XmlNode
      :param `handler`: 
      :type `handler`: wx.richtext.RichTextXMLHandler
      :param `recurse`: 
      :type `recurse`: bool




      :rtype: `bool`








   .. method:: IsEmpty(self)

      Returns ``True`` if the object is empty.                  

      :rtype: `bool`








   .. method:: IsFloatable(self)

      Returns ``True`` if this class of object is floatable.                  

      :rtype: `bool`








   .. method:: Layout(self, dc, context, rect, parentRect, style)

      Lay the item out at the specified position with the given size constraint.                  

      Layout must set the cached size. `rect`  is the available space for the object, and `parentRect`  is the container that is used to determine a relative size or position (for example if a text box must be 50% of the parent text box).                  


      :param `dc`: 
      :type `dc`: wx.DC
      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext
      :param `rect`: 
      :type `rect`: wx.Rect
      :param `parentRect`: 
      :type `parentRect`: wx.Rect
      :param `style`: 
      :type `style`: int




      :rtype: `bool`








   .. method:: LoadAndScaleImageCache(self, image, sz, context, changed)

      Do the loading and scaling.                  


      :param `image`: 
      :type `image`: wx.Image
      :param `sz`: 
      :type `sz`: wx.Size
      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext
      :param `changed`: 
      :type `changed`: bool




      :rtype: `tuple`







      :returns: 

         ( `bool`, `changed` ) 








   .. method:: LoadImageCache(self, dc, context, retImageSize, resetCache=False, parentSize=DefaultSize)

      Creates a cached image at the required size.                  


      :param `dc`: 
      :type `dc`: wx.DC
      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext
      :param `retImageSize`: 
      :type `retImageSize`: wx.Size
      :param `resetCache`: 
      :type `resetCache`: bool
      :param `parentSize`: 
      :type `parentSize`: wx.Size




      :rtype: `bool`








   .. method:: ResetImageCache(self)

      Resets the image cache.                   





   .. method:: SetImageCache(self, bitmap)

      Sets the image cache.                  


      :param `bitmap`: 
      :type `bitmap`: wx.Bitmap







   .. method:: SetImageState(self, state)

      Sets the image state.                  


      :param `state`: 
      :type `state`: int







   .. method:: SetOriginalImageSize(self, sz)

      Sets the original image size.                  


      :param `sz`: 
      :type `sz`: wx.Size







   .. method:: UsesParagraphAttributes(self)

      Returns ``True`` if this object takes note of paragraph attributes (text and image objects don't).                  

      :rtype: `bool`








   .. attribute:: ImageBlock

      See :meth:`~wx.richtext.RichTextImage.GetImageBlock`


   .. attribute:: ImageCache

      See :meth:`~wx.richtext.RichTextImage.GetImageCache` and :meth:`~wx.richtext.RichTextImage.SetImageCache`


   .. attribute:: ImageState

      See :meth:`~wx.richtext.RichTextImage.GetImageState` and :meth:`~wx.richtext.RichTextImage.SetImageState`


   .. attribute:: NaturalSize

      See :meth:`~wx.richtext.RichTextImage.GetNaturalSize`


   .. attribute:: OriginalImageSize

      See :meth:`~wx.richtext.RichTextImage.GetOriginalImageSize` and :meth:`~wx.richtext.RichTextImage.SetOriginalImageSize`


   .. attribute:: PropertiesMenuLabel

      See :meth:`~wx.richtext.RichTextImage.GetPropertiesMenuLabel`


   .. attribute:: XMLNodeName

      See :meth:`~wx.richtext.RichTextImage.GetXMLNodeName`

