.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2017 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.richtext.RichTextPlainText:

==========================================================================================================================================
|phoenix_title|  **wx.richtext.RichTextPlainText**
==========================================================================================================================================

This object represents a single piece of text.          







         



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







|

|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>RichTextPlainText</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.RichTextPlainText_inheritance.png" alt="Inheritance diagram of RichTextPlainText" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Object.html" title="wx.Object" alt="" coords="63,5,144,35"/> <area shape="rect" id="node2" href="wx.richtext.RichTextObject.html" title="wx.richtext.RichTextObject" alt="" coords="11,83,197,112"/> <area shape="rect" id="node3" href="wx.richtext.RichTextPlainText.html" title="wx.richtext.RichTextPlainText" alt="" coords="4,160,203,189"/> </map> 
   </p>

|


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

================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextPlainText.__init__`                                  Constructor.
:meth:`~wx.richtext.RichTextPlainText.CalculateRange`                            Calculates the range of the object.
:meth:`~wx.richtext.RichTextPlainText.CanMerge`                                  Returns ``True`` if this object can merge itself with the given one.
:meth:`~wx.richtext.RichTextPlainText.CanSplit`                                  Returns ``True`` if this object can potentially be split, by virtue of having different virtual attributes for individual sub-objects.
:meth:`~wx.richtext.RichTextPlainText.Clone`                                     Clones the object.
:meth:`~wx.richtext.RichTextPlainText.Copy`                                      
:meth:`~wx.richtext.RichTextPlainText.DeleteRange`                               Deletes the given range.
:meth:`~wx.richtext.RichTextPlainText.DoSplit`                                   Do a split from `pos`, returning an object containing the second part, and setting the first part in 'this'.
:meth:`~wx.richtext.RichTextPlainText.Draw`                                      Draw the item, within the given range.
:meth:`~wx.richtext.RichTextPlainText.GetFirstLineBreakPosition`                 Get the first position from pos that has a line break character.
:meth:`~wx.richtext.RichTextPlainText.GetRangeSize`                              Returns the object size for the given range.
:meth:`~wx.richtext.RichTextPlainText.GetText`                                   Returns the text.
:meth:`~wx.richtext.RichTextPlainText.GetTextForRange`                           Returns any text in this object for the given range.
:meth:`~wx.richtext.RichTextPlainText.GetXMLNodeName`                            Returns the ``XML`` node name of this object.
:meth:`~wx.richtext.RichTextPlainText.ImportFromXML`                             Imports this object from ``XML``.
:meth:`~wx.richtext.RichTextPlainText.IsEmpty`                                   Returns ``True`` if the object is empty.
:meth:`~wx.richtext.RichTextPlainText.Layout`                                    Lay the item out at the specified position with the given size constraint.
:meth:`~wx.richtext.RichTextPlainText.Merge`                                     Returns ``True`` if this object merged itself with the given one.
:meth:`~wx.richtext.RichTextPlainText.SetText`                                   Sets the text.
:meth:`~wx.richtext.RichTextPlainText.Split`                                     Returns the final object in the split objects if this object was split due to differences between sub-object virtual attributes.
:meth:`~wx.richtext.RichTextPlainText.UsesParagraphAttributes`                   Does this object take note of paragraph attributes? Text and image objects don't.
================================================================================ ================================================================================


|


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

================================================================================ ================================================================================
:attr:`~wx.richtext.RichTextPlainText.Text`                                      See :meth:`~wx.richtext.RichTextPlainText.GetText` and :meth:`~wx.richtext.RichTextPlainText.SetText`
:attr:`~wx.richtext.RichTextPlainText.XMLNodeName`                               See :meth:`~wx.richtext.RichTextPlainText.GetXMLNodeName`
================================================================================ ================================================================================


|


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


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

   **Possible constructors**::

       RichTextPlainText(text="", parent=None, style=None)
       
       RichTextPlainText(obj)
       
   
   This object represents a single piece of text.



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



      |overload| Overloaded Implementations:

      **~~~**

      
      **__init__** `(self, text=EmptyString, parent=None, style=None)`
      
      Constructor.                  
      
      
      :param `text`: 
      :type `text`: string
      :param `parent`: 
      :type `parent`: wx.richtext.RichTextObject
      :param `style`: 
      :type `style`: wx.richtext.RichTextAttr
      
      
      
      
      
      
      **~~~**

      
      **__init__** `(self, obj)`
      
      Copy constructor.                  
      
      
      :param `obj`: 
      :type `obj`: wx.richtext.RichTextPlainText
      
      
      
      
      
      
      **~~~**






   .. method:: CalculateRange(self, start)

      Calculates the range of the object.                  

      By default, guess that the object is 1 unit long.                  


      :param `start`: 
      :type `start`: long




      :rtype: `end`








   .. method:: CanMerge(self, object, context)

      Returns ``True`` if this object can merge itself with the given one.                  


      :param `object`: 
      :type `object`: wx.richtext.RichTextObject
      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext




      :rtype: `bool`








   .. method:: CanSplit(self, context)

      Returns ``True`` if this object can potentially be split, by virtue of having different virtual attributes for individual sub-objects.                  


      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext




      :rtype: `bool`








   .. method:: Clone(self)

      Clones the object.                  

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








   .. method:: Copy(self, obj)




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







   .. method:: DeleteRange(self, range)

      Deletes the given range.                  


      :param `range`: 
      :type `range`: wx.richtext.RichTextRange




      :rtype: `bool`








   .. method:: DoSplit(self, pos)

      Do a split from `pos`, returning an object containing the second part, and setting the first part in 'this'.                  


      :param `pos`: 
      :type `pos`: long




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








   .. 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:: GetFirstLineBreakPosition(self, pos)

      Get the first position from pos that has a line break character.                  


      :param `pos`: 
      :type `pos`: long




      :rtype: `long`








   .. 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:: GetText(self)

      Returns the text.                  

      :rtype: `string`








   .. method:: GetTextForRange(self, range)

      Returns any text in this object for the given range.                  


      :param `range`: 
      :type `range`: wx.richtext.RichTextRange




      :rtype: `string`








   .. 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:: 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:: Merge(self, object, context)

      Returns ``True`` if this object merged itself with the given one.                  

      The calling code will then delete the given object.                  


      :param `object`: 
      :type `object`: wx.richtext.RichTextObject
      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext




      :rtype: `bool`








   .. method:: SetText(self, text)

      Sets the text.                  


      :param `text`: 
      :type `text`: string







   .. method:: Split(self, context)

      Returns the final object in the split objects if this object was split due to differences between sub-object virtual attributes.                  

      Returns itself if it was not split.                  


      :param `context`: 
      :type `context`: wx.richtext.RichTextDrawingContext




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








   .. method:: UsesParagraphAttributes(self)

      Does this object take note of paragraph attributes? Text and image objects don't.                  

      :rtype: `bool`








   .. attribute:: Text

      See :meth:`~wx.richtext.RichTextPlainText.GetText` and :meth:`~wx.richtext.RichTextPlainText.SetText`


   .. attribute:: XMLNodeName

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

