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

==========================================================================================================================================
|phoenix_title|  **wx.richtext.RichTextRange**
==========================================================================================================================================

This stores beginning and end positions for a range of data.          





         



.. 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>RichTextRange</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.RichTextRange_inheritance.png" alt="Inheritance diagram of RichTextRange" 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.RichTextRange.html" title="wx.richtext.RichTextRange" alt="" coords="5,5,200,35"/> </map> 
   </p>
   </div>

|


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

================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextRange.__init__`                                      Default constructor.
:meth:`~wx.richtext.RichTextRange.Contains`                                      Returns ``True`` if `pos`  was within the range.
:meth:`~wx.richtext.RichTextRange.FromInternal`                                  Converts the internal range, which uses the first and last character positions of the range, to the API-standard range, whose end is one past the last character in the range.
:meth:`~wx.richtext.RichTextRange.Get`                                           Return the start and end properties as a tuple.
:meth:`~wx.richtext.RichTextRange.GetEnd`                                        Gets the end position.
:meth:`~wx.richtext.RichTextRange.GetIM`                                         Returns an immutable representation of the ``wx.RichTextRange`` object, based on ``namedtuple``.
:meth:`~wx.richtext.RichTextRange.GetLength`                                     Gets the length of the range.
:meth:`~wx.richtext.RichTextRange.GetStart`                                      Returns the start position.
:meth:`~wx.richtext.RichTextRange.IsOutside`                                     Returns ``True`` if this range is completely outside `range`.
:meth:`~wx.richtext.RichTextRange.IsWithin`                                      Returns ``True`` if this range is completely within `range`.
:meth:`~wx.richtext.RichTextRange.LimitTo`                                       Limit this range to be within `range`.
:meth:`~wx.richtext.RichTextRange.SetEnd`                                        Sets the end position.
:meth:`~wx.richtext.RichTextRange.SetRange`                                      Sets the range start and end positions.
:meth:`~wx.richtext.RichTextRange.SetStart`                                      Sets the start position.
:meth:`~wx.richtext.RichTextRange.Swap`                                          Swaps the start and end.
:meth:`~wx.richtext.RichTextRange.ToInternal`                                    Converts the API-standard range, whose end is one past the last character in the range, to the internal form, which uses the first and last character positions of the range.
:meth:`~wx.richtext.RichTextRange.__bool__`                                      
:meth:`~wx.richtext.RichTextRange.__getitem__`                                   
:meth:`~wx.richtext.RichTextRange.__len__`                                       
:meth:`~wx.richtext.RichTextRange.__nonzero__`                                   
:meth:`~wx.richtext.RichTextRange.__reduce__`                                    
:meth:`~wx.richtext.RichTextRange.__repr__`                                      
:meth:`~wx.richtext.RichTextRange.__setitem__`                                   
:meth:`~wx.richtext.RichTextRange.__str__`                                       
:meth:`~wx.richtext.RichTextRange.__ne__`                                        Inequality operator.
:meth:`~wx.richtext.RichTextRange.__add__`                                       Adds a range to this range.
:meth:`~wx.richtext.RichTextRange.__sub__`                                       Subtracts a range from this range.
:meth:`~wx.richtext.RichTextRange.__eq__`                                        Equality operator.
================================================================================ ================================================================================


|


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

================================================================================ ================================================================================
:attr:`~wx.richtext.RichTextRange.End`                                           See :meth:`~wx.richtext.RichTextRange.GetEnd` and :meth:`~wx.richtext.RichTextRange.SetEnd`
:attr:`~wx.richtext.RichTextRange.Length`                                        See :meth:`~wx.richtext.RichTextRange.GetLength`
:attr:`~wx.richtext.RichTextRange.Start`                                         See :meth:`~wx.richtext.RichTextRange.GetStart` and :meth:`~wx.richtext.RichTextRange.SetStart`
================================================================================ ================================================================================


|


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


.. class:: wx.richtext.RichTextRange(object)

   **Possible constructors**::

       RichTextRange()
       
       RichTextRange(start, end)
       
       RichTextRange(range)
       
   
   This stores beginning and end positions for a range of data.



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



      |overload| Overloaded Implementations:

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

      
      **__init__** `(self)`
      
      Default constructor.                   
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, start, end)`
      
      Constructor taking start and end positions.                  
      
      
      :param `start`: 
      :type `start`: long
      :param `end`: 
      :type `end`: long
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

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






   .. method:: Contains(self, pos)

      Returns ``True`` if `pos`  was within the range.                  

      Does not match if the range is empty.                  


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




      :rtype: `bool`








   .. method:: FromInternal(self)

      Converts the internal range, which uses the first and last character positions of the range, to the API-standard range, whose end is one past the last character in the range.                  

      In other words, one is added to the end position. (n, n+1) is the range of a single character.                  

      :rtype: :ref:`wx.richtext.RichTextRange`








   .. method:: Get(self)

      Return the start and end properties as a tuple. 

      :rtype: `tuple`







      :returns: 

         ( `start`, `end` ) 








   .. method:: GetEnd(self)

      Gets the end position.                  

      :rtype: `long`








   .. method:: GetIM(self)

      Returns an immutable representation of the ``wx.RichTextRange`` object, based on ``namedtuple``.
      
      This new object is hashable and can be used as a dictionary key,
      be added to sets, etc.  It can be converted back into a real ``wx.RichTextRange``
      with a simple statement like this: ``obj = wx.RichTextRange(imObj)``.



   .. method:: GetLength(self)

      Gets the length of the range.                  

      :rtype: `long`








   .. method:: GetStart(self)

      Returns the start position.                  

      :rtype: `long`








   .. method:: IsOutside(self, range)

      Returns ``True`` if this range is completely outside `range`.                  


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




      :rtype: `bool`








   .. method:: IsWithin(self, range)

      Returns ``True`` if this range is completely within `range`.                  


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




      :rtype: `bool`








   .. method:: LimitTo(self, range)

      Limit this range to be within `range`.                  


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




      :rtype: `bool`








   .. method:: SetEnd(self, end)

      Sets the end position.                  


      :param `end`: 
      :type `end`: long







   .. method:: SetRange(self, start, end)

      Sets the range start and end positions.                  


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







   .. method:: SetStart(self, start)

      Sets the start position.                  


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







   .. method:: Swap(self)

      Swaps the start and end.                   





   .. method:: ToInternal(self)

      Converts the API-standard range, whose end is one past the last character in the range, to the internal form, which uses the first and last character positions of the range.                  

      In other words, one is subtracted from the end position. (n, n) is the range of a single character.                  

      :rtype: :ref:`wx.richtext.RichTextRange`








   .. method:: __bool__(self)




   .. method:: __getitem__(self, idx)




   .. method:: __len__(self)




   .. method:: __nonzero__(self)




   .. method:: __reduce__(self)




   .. method:: __repr__(self)




   .. method:: __setitem__(self, idx, val)




   .. method:: __str__(self)




   .. method:: __ne__(self)

      Inequality operator.                  


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







   .. method:: __add__(self)

      Adds a range to this range.                  


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







   .. method:: __sub__(self)

      Subtracts a range from this range.                  


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







   .. method:: __eq__(self)

      Equality operator.                  

      Returns ``True`` if `range`  is the same as this range.                  


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







   .. attribute:: End

      See :meth:`~wx.richtext.RichTextRange.GetEnd` and :meth:`~wx.richtext.RichTextRange.SetEnd`


   .. attribute:: Length

      See :meth:`~wx.richtext.RichTextRange.GetLength`


   .. attribute:: Start

      See :meth:`~wx.richtext.RichTextRange.GetStart` and :meth:`~wx.richtext.RichTextRange.SetStart`

