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

Inheritance diagram for class
RichTextPlainText:
|
|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: str='', parent: Optional[RichTextObject]=None,
style: Optional[RichTextAttr]=None) -> None
RichTextPlainText(obj : RichTextPlainText) -> None
This object represents a single piece of text.
.. method:: __init__(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**__init__** `(self, text: str='', parent: Optional[RichTextObject]=None, style: Optional[RichTextAttr]=None)`
Constructor.
:param `text`:
:type `text`: string
:param `parent`:
:type `parent`: wx.richtext.RichTextObject
:param `style`:
:type `style`: wx.richtext.RichTextAttr
:rtype: `None`
:html:`
`
**__init__** `(self, obj : RichTextPlainText)`
Copy constructor.
:param `obj`:
:type `obj`: wx.richtext.RichTextPlainText
:rtype: `None`
:html:`
`
.. method:: CalculateRange(self, start : int)
Calculates the range of the object.
By default, guess that the object is 1 unit long.
:param `start`:
:type `start`: long
:rtype: `int`
.. method:: CanMerge(self, object : RichTextObject, context : RichTextDrawingContext)
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 : RichTextDrawingContext)
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 : RichTextPlainText)
:param `obj`:
:type `obj`: wx.richtext.RichTextPlainText
:rtype: `None`
.. method:: DeleteRange(self, range : RichTextRange)
Deletes the given range.
:param `range`:
:type `range`: wx.richtext.RichTextRange
:rtype: `bool`
.. method:: DoSplit(self, pos : int)
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 : DC, context : RichTextDrawingContext, range : RichTextRange, selection : RichTextSelection, rect : Rect, descent : int, style : int)
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 : int)
Get the first position from pos that has a line break character.
:param `pos`:
:type `pos`: long
:rtype: `int`
.. method:: GetRangeSize(self, range : RichTextRange, size : Size, descent : int, dc : DC, context : RichTextDrawingContext, flags : int, position: Point=Point(0,0), parentSize: Size=DefaultSize, partialExtents: Optional[List[int]]=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: `str`
.. method:: GetTextForRange(self, range : RichTextRange)
Returns any text in this object for the given range.
:param `range`:
:type `range`: wx.richtext.RichTextRange
:rtype: `str`
.. method:: GetXMLNodeName(self)
Returns the ``XML`` node name of this object.
This must be overridden for XmlNode-base ``XML`` export to work.
:rtype: `str`
.. method:: ImportFromXML(self, buffer : RichTextBuffer, node : XmlNode, handler : RichTextXMLHandler, recurse : bool)
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 : DC, context : RichTextDrawingContext, rect : Rect, parentRect : Rect, style : int)
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 : RichTextObject, context : RichTextDrawingContext)
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 : str)
Sets the text.
:param `text`:
:type `text`: string
:rtype: `None`
.. method:: Split(self, context : RichTextDrawingContext)
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`