phoenix_title wx.richtext.RichTextCtrl

wx.richtext.RichTextCtrl provides a generic, ground-up implementation of a text control capable of showing multiple styles and images.

wx.richtext.RichTextCtrl sends notification events: see wx.richtext.RichTextEvent.

It also sends the standard wx.TextCtrl events wxEVT_TEXT_ENTER and wxEVT_TEXT , and wx.TextUrlEvent when URL content is clicked.

For more information, see the RichTextCtrl Overview.

styles Window Styles

This class supports the following styles:

  • wx.richtext.RE_CENTRE_CARET: The control will try to keep the caret line centred vertically while editing. wx.richtext.RE_CENTER_CARET is a synonym for this style.

  • wx.richtext.RE_MULTILINE: The control will be multiline (mandatory).

  • wx.richtext.RE_READONLY: The control will not be editable.


class_hierarchy Class Hierarchy

Inheritance diagram for class RichTextCtrl:

method_summary Methods Summary

__init__

Default constructor.

AddImage

Adds an image to the control’s buffer.

AddParagraph

Adds a new paragraph of text to the end of the buffer.

AppendText

Sets the insertion point to the end of the buffer and writes the text.

ApplyAlignmentToSelection

Applies the given alignment to the selection or the default style (undoable).

ApplyBoldToSelection

Apples bold to the selection or the default style (undoable).

ApplyItalicToSelection

Applies italic to the selection or the default style (undoable).

ApplyStyle

Applies the style sheet to the buffer, matching paragraph styles in the sheet against named styles in the buffer.

ApplyStyleSheet

Applies the style sheet to the buffer, for example if the styles have changed.

ApplyTextEffectToSelection

Applies one or more TextAttrEffects flags to the selection (undoable).

ApplyUnderlineToSelection

Applies underline to the selection or the default style (undoable).

AutoComplete

Call this function to enable auto-completion of the text typed in a single-line text control using the given choices.

AutoCompleteDirectories

Call this function to enable auto-completion of the text using the file system directories.

AutoCompleteFileNames

Call this function to enable auto-completion of the text typed in a single-line text control using all valid file system paths.

BatchingUndo

Returns True if undo commands are being batched.

BeginAlignment

Begins using alignment.

BeginBatchUndo

Starts batching undo history for commands.

BeginBold

Begins using bold.

BeginCharacterStyle

Begins using the named character style.

BeginFont

Begins using this font.

BeginFontSize

Begins using the given point size.

BeginItalic

Begins using italic.

BeginLeftIndent

Begins applying a left indent and subindent in tenths of a millimetre.

BeginLineSpacing

Begins appling line spacing.

BeginListStyle

Begins using a specified list style.

BeginNumberedBullet

Begins a numbered bullet.

BeginParagraphSpacing

Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of a millimetre.

BeginParagraphStyle

Begins applying the named paragraph style.

BeginRightIndent

Begins a right indent, specified in tenths of a millimetre.

BeginStandardBullet

Begins applying a symbol bullet.

BeginStyle

Begins applying a style.

BeginSuppressUndo

Starts suppressing undo history for commands.

BeginSymbolBullet

Begins applying a symbol bullet, using a character from the current font.

BeginTextColour

Begins using this colour.

BeginURL

Begins applying wx.TEXT_ATTR_URL to the content.

BeginUnderline

Begins using underlining.

CanCopy

Returns True if selected content can be copied to the clipboard.

CanCut

Returns True if selected content can be copied to the clipboard and deleted.

CanDeleteRange

Can we delete this range? Sends an event to the control.

CanDeleteSelection

Returns True if selected content can be deleted.

CanEditProperties

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

CanInsertContent

Can we insert content at this position? Sends an event to the control.

CanPaste

Returns True if the clipboard content can be pasted to the buffer.

CanRedo

Returns True if there is a command in the command history that can be redone.

CanUndo

Returns True if there is a command in the command history that can be undone.

ChangeValue

Sets the new text control value.

Clear

Clears the buffer content, leaving a single empty paragraph.

ClearAvailableFontNames

Clears the cache of available font names.

ClearListStyle

Clears the list style from the given range, clearing list-related attributes and applying any named paragraph style associated with each paragraph.

Command

Sends the event to the control.

Copy

Copies the selected content (if any) to the clipboard.

Create

Creates the underlying window.

Cut

Copies the selected content (if any) to the clipboard and deletes the selection.

Delete

Deletes the content within the given range.

DeleteSelectedContent

Deletes content if there is a selection, e.g.

DeleteSelection

Deletes the content in the selection, if any.

DiscardEdits

Sets the buffer’s modified status to False, and clears the buffer’s command history.

DoGetBestSize

Currently this simply returns wx.Size.

DoGetValue

DoLayoutBuffer

Implements layout.

DoLoadFile

Helper function for LoadFile .

DoSaveFile

Helper function for SaveFile .

DoThaw

DoWriteText

DoesSelectionHaveTextEffectFlag

Returns True if all of the selection, or the content at the current caret position, has the supplied TextAttrEffects flag(s).

EditProperties

Edits the object’s properties via a GUI.

EnableDelayedImageLoading

Enable or disable delayed image loading.

EnableImages

Enable or disable images.

EnableVerticalScrollbar

Enable or disable the vertical scrollbar.

EnableVirtualAttributes

Pass True to let the control use virtual attributes.

EndAlignment

Ends alignment.

EndAllStyles

Ends application of all styles in the current style stack.

EndBatchUndo

Ends batching undo command history.

EndBold

Ends using bold.

EndCharacterStyle

Ends application of a named character style.

EndFont

Ends using a font.

EndFontSize

Ends using a point size.

EndItalic

Ends using italic.

EndLeftIndent

Ends left indent.

EndLineSpacing

Ends line spacing.

EndListStyle

Ends using a specified list style.

EndNumberedBullet

Ends application of a numbered bullet.

EndParagraphSpacing

Ends paragraph spacing.

EndParagraphStyle

Ends application of a named paragraph style.

EndRightIndent

Ends right indent.

EndStandardBullet

Begins applying a standard bullet.

EndStyle

Ends the current style.

EndSuppressUndo

Ends suppressing undo command history.

EndSymbolBullet

Ends applying a symbol bullet.

EndTextColour

Ends applying a text colour.

EndURL

Ends applying a URL.

EndUnderline

End applying underlining.

ExtendCellSelection

Extends a table selection in the given direction.

ExtendSelection

Helper function for extending the selection, returning True if the selection was changed.

FindCaretPositionForCharacterPosition

Find the caret position for the combination of hit-test flags and character position.

FindContainerAtPoint

Finds the container at the given point, which is assumed to be in client coordinates.

FindNextWordPosition

Helper function for finding the caret position for the next word.

FindRangeForList

Given a character position at which there is a list style, find the range encompassing the same list style by looking backwards and forwards.

ForceDelayedLayout

ForceUpper

Convert all text entered into the control to upper case.

GetAdjustedCaretPosition

The adjusted caret position is the character position adjusted to take into account whether we’re at the start of a paragraph, in which case style information should be taken from the next position, not current one.

GetAvailableFontNames

Font names take a long time to retrieve, so cache them (on demand).

GetBasicStyle

Gets the basic (overall) style.

GetBuffer

Returns the buffer associated with the control.

GetCaretAtLineStart

Returns True if we are showing the caret position at the start of a line instead of at the end of the previous one.

GetCaretPosition

Returns the current caret position.

GetCaretPositionForDefaultStyle

Returns the caret position since the default formatting was changed.

GetCaretPositionForIndex

Returns the caret height and position for the given character position.

GetClassDefaultAttributes

GetCommandProcessor

Gets the command processor associated with the control’s buffer.

GetContextMenu

Returns the current context menu.

GetContextMenuPropertiesInfo

Returns an object that stores information about context menu property item(s), in order to communicate between the context menu event handler and the code that responds to it.

GetDefaultStyleEx

Returns the current default style, which can be used to change how subsequently inserted text is displayed.

GetDelayedImageLoading

Returns True if delayed image loading is enabled.

GetDelayedImageProcessingRequired

Gets the flag indicating that delayed image processing is required.

GetDelayedImageProcessingTime

Returns the last time delayed image processing was performed.

GetDelayedLayoutThreshold

Gets the size of the buffer beyond which layout is delayed during resizing.

GetDimensionScale

Returns the scale factor for displaying certain dimensions such as indentation and inter-paragraph spacing.

GetDragStartPoint

Get the possible Drag’n’Drop start point.

GetDragStartTime

Get the possible Drag’n’Drop start time.

GetDragging

Returns True if we are extending a selection.

GetFilename

Gets the current filename associated with the control.

GetFirstVisiblePoint

Returns the first visible point in the window.

GetFirstVisiblePosition

Returns the first visible position in the current view.

GetFocusObject

Returns the wx.richtext.RichTextObject object that currently has the editing focus.

GetFontScale

Returns the scale factor for displaying fonts, for example for more comfortable editing.

GetFullLayoutRequired

GetFullLayoutSavedPosition

GetFullLayoutTime

GetHandlerFlags

Returns flags that change the behaviour of loading or saving.

GetHint

Returns the current hint string.

GetImagesEnabled

Returns True if images are enabled.

GetInsertionPoint

Returns the current insertion point.

GetInternalSelectionRange

Returns the selection range in character positions.

GetLastPosition

Returns the last position in the buffer.

GetLineLength

Returns the length of the specified line in characters.

GetLineText

Returns the text for the given line.

GetLogicalPoint

Transforms physical window position to logical (unscrolled) position.

GetMargins

Returns the margins used by the control.

GetNumberOfLines

Returns the number of lines in the buffer.

GetPhysicalPoint

Transforms logical (unscrolled) position to physical window position.

GetPreDrag

Are we trying to start Drag’n’Drop?

GetPropertiesMenuLabel

Gets the object’s properties menu label.

GetRange

Gets the text for the given range.

GetScale

Returns an overall scale factor for displaying and editing the content.

GetScaledPoint

Returns a scaled point.

GetScaledRect

Returns a scaled rectangle.

GetScaledSize

Returns a scaled size.

GetSelection

Returns the range of the current selection.

GetSelectionAnchor

Returns an anchor so we know how to extend the selection.

GetSelectionAnchorObject

Returns the anchor object if selecting multiple containers.

GetSelectionRange

Returns the selection range in character positions.

GetStringSelection

Returns the text within the current selection range, if any.

GetStyle

Gets the attributes at the given position.

GetStyleForRange

Gets the attributes common to the specified range.

GetStyleSheet

Returns the style sheet associated with the control, if any.

GetTextCursor

Returns the text (normal) cursor.

GetURLCursor

Returns the cursor to be used over URLs.

GetUncombinedStyle

Gets the attributes at the given position.

GetUnscaledPoint

Returns an unscaled point.

GetUnscaledRect

Returns an unscaled rectangle.

GetUnscaledSize

Returns an unscaled size.

GetValue

Returns the content of the entire control as a string.

GetVerticalScrollbarEnabled

Returns True if the vertical scrollbar is enabled.

GetVirtualAttributesEnabled

Returns True if this control can use virtual attributes and virtual text.

GetVisibleLineForCaretPosition

Internal helper function returning the line for the visible caret position.

HasCharacterAttributes

Test if this whole range has character attributes of the specified kind.

HasParagraphAttributes

Test if this whole range has paragraph attributes of the specified kind.

HasSelection

Returns True if there is a selection and the object containing the selection was the same as the current focus object.

HasUnfocusedSelection

Returns True if there was a selection, whether or not the current focus object is the same as the selection’s container object.

HitTest

Finds the character at the given position in pixels.

HitTestXY

Finds the character at the given position in pixels.

Init

Initialises the members of the control.

Invalidate

Invalidates the whole buffer to trigger painting later.

IsDefaultStyleShowing

Returns True if the user has recently set the default style without moving the caret, and therefore the UI needs to reflect the default style and not the style at the caret.

IsEditable

Returns True if the control is editable.

IsEmpty

Returns True if the control is currently empty.

IsModified

Returns True if the buffer has been modified.

IsMultiLine

Returns True if the control is multiline.

IsPositionVisible

Returns True if the given position is visible on the screen.

IsSelectionAligned

Returns True if all of the selection is aligned according to the specified flag.

IsSelectionBold

Returns True if all of the selection, or the content at the caret position, is bold.

IsSelectionItalics

Returns True if all of the selection, or the content at the caret position, is italic.

IsSelectionUnderlined

Returns True if all of the selection, or the content at the caret position, is underlined.

IsSingleLine

Returns True if the control is single-line.

KeyboardNavigate

Helper function implementing keyboard navigation.

LayoutContent

Lays out the buffer, which must be done before certain operations, such as setting the caret position.

LineBreak

Inserts a line break at the current insertion point.

LoadFile

Loads content into the control’s buffer using the given type.

MarkDirty

Marks the buffer as modified.

MoveCaret

Move the caret to the given character position.

MoveCaretBack

Move the caret one visual step forward: this may mean setting a flag and keeping the same position if we’re going from the end of one line to the start of the next, which may be the exact same caret position.

MoveCaretForward

Move the caret one visual step forward: this may mean setting a flag and keeping the same position if we’re going from the end of one line to the start of the next, which may be the exact same caret position.

MoveDown

Moves the caret down.

MoveEnd

Moves to the end of the buffer.

MoveHome

Moves to the start of the buffer.

MoveLeft

Moves left.

MoveRight

Moves right.

MoveToLineEnd

Moves to the end of the line.

MoveToLineStart

Moves to the start of the line.

MoveToParagraphEnd

Moves to the end of the paragraph.

MoveToParagraphStart

Moves to the start of the paragraph.

MoveUp

Moves to the start of the paragraph.

Newline

Inserts a new paragraph at the current insertion point.

NumberList

Numbers the paragraphs in the given range.

OnCaptureLost

OnChar

OnClear

Standard handler for the wx.ID_CLEAR command.

OnContextMenu

Shows a standard context menu with undo, redo, cut, copy, paste, clear, and select all commands.

OnCopy

Standard handler for the wx.ID_COPY command.

OnCut

Standard handler for the wx.ID_CUT command.

OnDropFiles

Loads the first dropped file.

OnEraseBackground

OnIdle

OnKillFocus

OnLeftClick

OnLeftDClick

OnLeftUp

OnMiddleClick

OnMoveMouse

OnPaint

OnPaste

Standard handler for the wx.ID_PASTE command.

OnProperties

Standard handler for property commands.

OnRedo

Standard handler for the wx.ID_REDO command.

OnRightClick

OnScroll

OnSelectAll

Standard handler for the wx.ID_SELECTALL command.

OnSetFocus

OnSize

OnSysColourChanged

OnTimer

Respond to timer events.

OnUndo

Standard handler for the wx.ID_UNDO command.

OnUpdateClear

Standard update handler for the wx.ID_CLEAR command.

OnUpdateCopy

Standard update handler for the wx.ID_COPY command.

OnUpdateCut

Standard update handler for the wx.ID_CUT command.

OnUpdatePaste

Standard update handler for the wx.ID_PASTE command.

OnUpdateProperties

Standard update handler for property commands.

OnUpdateRedo

Standard update handler for the wx.ID_REDO command.

OnUpdateSelectAll

Standard update handler for the wx.ID_SELECTALL command.

OnUpdateUndo

Standard update handler for the wx.ID_UNDO command.

PageDown

Moves one or more pages down.

PageUp

Moves one or more pages up.

PaintAboveContent

Other user defined painting after everything else (i.e. all text) is painted.

PaintBackground

Paints the background.

Paste

Pastes content from the clipboard to the buffer.

PopStyleSheet

Pops the style sheet from top of stack.

PositionCaret

Internal function to position the visible caret according to the current caret position.

PositionToXY

Converts a text position to zero-based column and line numbers.

PrepareContent

Prepares the content just before insertion (or after buffer reset).

PrepareContextMenu

Prepares the context menu, optionally adding appropriate property-editing commands.

ProcessBackKey

Processes the back key.

ProcessDelayedImageLoading

Do delayed image loading and garbage-collect other images.

ProcessMouseMovement

Processes mouse movement in order to change the cursor.

PromoteList

Promotes or demotes the paragraphs in the given range.

PushStyleSheet

Push the style sheet to top of stack.

Redo

Redoes the current command.

RefreshForSelectionChange

Refreshes the area affected by a selection change.

Remove

Removes the content in the specified range.

Replace

Replaces the content in the specified range with the string specified by value.

RequestDelayedImageProcessing

Request delayed image processing.

SaveFile

Saves the buffer content using the given type.

ScrollIntoView

Scrolls position into view.

SelectAll

Selects all the text in the buffer.

SelectNone

Cancels any selection.

SelectWord

Selects the word at the given character position.

SetAndShowDefaultStyle

Sets attr as the default style and tells the control that the UI should reflect this attribute until the user moves the caret.

SetBasicStyle

Sets the basic (overall) style.

SetCaretAtLineStart

Sets a flag to remember that we are showing the caret position at the start of a line instead of at the end of the previous one.

SetCaretPosition

Sets the caret position.

SetCaretPositionAfterClick

Sets up the caret for the given position and container, after a mouse click.

SetCaretPositionForDefaultStyle

Set the caret position for the default style that the user is selecting.

SetContextMenu

Sets the current context menu.

SetDefaultStyle

Sets the current default style, which can be used to change how subsequently inserted text is displayed.

SetDefaultStyleToCursorStyle

Sets the default style to the style under the cursor.

SetDelayedImageProcessingRequired

Sets the flag indicating that delayed image processing is required.

SetDelayedImageProcessingTime

Sets the last time delayed image processing was performed.

SetDelayedLayoutThreshold

Sets the size of the buffer beyond which layout is delayed during resizing.

SetDimensionScale

Sets the scale factor for displaying certain dimensions such as indentation and inter-paragraph spacing.

SetDragStartPoint

Set the possible Drag’n’Drop start point.

SetDragStartTime

Set the possible Drag’n’Drop start time.

SetDragging

Sets a flag to remember if we are extending a selection.

SetEditable

Makes the control editable, or not.

SetFilename

Sets the current filename.

SetFocusObject

Sets the wx.richtext.RichTextObject object that currently has the editing focus.

SetFont

Sets the font, and also the basic and default attributes (see wx.richtext.RichTextCtrl.SetDefaultStyle ).

SetFontScale

Sets the scale factor for displaying fonts, for example for more comfortable editing.

SetFullLayoutRequired

SetFullLayoutSavedPosition

SetFullLayoutTime

SetHandlerFlags

Sets flags that change the behaviour of loading or saving.

SetHint

Sets a hint shown in an empty unfocused text control.

SetInsertionPoint

Sets the insertion point and causes the current editing style to be taken from the new position (unlike wx.richtext.RichTextCtrl.SetCaretPosition ).

SetInsertionPointEnd

Sets the insertion point to the end of the text control.

SetInternalSelectionRange

Sets the selection range in character positions.

SetListStyle

Sets the list attributes for the given range, passing flags to determine how the attributes are set.

SetMargins

Attempts to set the control margins.

SetMaxLength

Sets the maximum number of characters that may be entered in a single line text control.

SetModified

SetPreDrag

Set if we’re trying to start Drag’n’Drop.

SetProperties

Sets the properties for the given range, passing flags to determine how the attributes are set.

SetScale

Sets an overall scale factor for displaying and editing the content.

SetSelection

Sets the selection to the given range.

SetSelectionAnchor

Sets an anchor so we know how to extend the selection.

SetSelectionAnchorObject

Sets the anchor object if selecting multiple containers.

SetSelectionRange

Sets the selection to the given range.

SetStyle

Sets the attributes for the given range.

SetStyleEx

Sets the attributes for the given range, passing flags to determine how the attributes are set.

SetStyleSheet

Sets the style sheet associated with the control.

SetTextCursor

Sets the text (normal) cursor.

SetURLCursor

Sets the cursor to be used over URLs.

SetValue

Replaces existing content with the given text.

SetupScrollbars

A helper function setting up scrollbars, for example after a resize.

ShouldInheritColours

Return True from here to allow the colours of this window to be changed by InheritAttributes .

ShowContextMenu

Shows the given context menu, optionally adding appropriate property-editing commands for the current position in the object hierarchy.

ShowPosition

Scrolls the buffer so that the given position is in view.

StartCellSelection

Starts selecting table cells.

StoreFocusObject

Setter for m_focusObject.

SuppressingUndo

Returns True if undo history suppression is on.

Undo

Undoes the command at the top of the command history, if there is one.

WordLeft

Moves a number of words to the left.

WordRight

Move a number of words to the right.

WriteField

Writes a field at the current insertion point.

WriteImage

Write a bitmap or image at the current insertion point.

WriteTable

Write a table at the current insertion point, returning the table.

WriteText

Writes text at the current position.

WriteTextBox

Write a text box at the current insertion point, returning the text box.

XYToPosition

Translates from column and line number to position.


property_summary Properties Summary

BasicStyle

See GetBasicStyle and SetBasicStyle

Buffer

See GetBuffer

CaretAtLineStart

See GetCaretAtLineStart and SetCaretAtLineStart

CaretPosition

See GetCaretPosition and SetCaretPosition

CaretPositionForDefaultStyle

See GetCaretPositionForDefaultStyle and SetCaretPositionForDefaultStyle

CommandProcessor

See GetCommandProcessor

ContextMenu

See GetContextMenu and SetContextMenu

ContextMenuPropertiesInfo

See GetContextMenuPropertiesInfo

DefaultStyle

See GetDefaultStyle and SetDefaultStyle

DefaultStyleEx

See GetDefaultStyleEx

DelayedImageLoading

See GetDelayedImageLoading

DelayedImageProcessingRequired

See GetDelayedImageProcessingRequired and SetDelayedImageProcessingRequired

DelayedImageProcessingTime

See GetDelayedImageProcessingTime and SetDelayedImageProcessingTime

DelayedLayoutThreshold

See GetDelayedLayoutThreshold and SetDelayedLayoutThreshold

DimensionScale

See GetDimensionScale and SetDimensionScale

DragStartPoint

See GetDragStartPoint and SetDragStartPoint

DragStartTime

See GetDragStartTime and SetDragStartTime

Dragging

See GetDragging and SetDragging

Filename

See GetFilename and SetFilename

FirstVisiblePoint

See GetFirstVisiblePoint

FirstVisiblePosition

See GetFirstVisiblePosition

FocusObject

See GetFocusObject and SetFocusObject

FontScale

See GetFontScale and SetFontScale

FullLayoutRequired

See GetFullLayoutRequired and SetFullLayoutRequired

FullLayoutSavedPosition

See GetFullLayoutSavedPosition and SetFullLayoutSavedPosition

FullLayoutTime

See GetFullLayoutTime and SetFullLayoutTime

HandlerFlags

See GetHandlerFlags and SetHandlerFlags

Hint

See GetHint and SetHint

ImagesEnabled

See GetImagesEnabled

InsertionPoint

See GetInsertionPoint and SetInsertionPoint

InternalSelectionRange

See GetInternalSelectionRange and SetInternalSelectionRange

LastPosition

See GetLastPosition

Margins

See GetMargins and SetMargins

NumberOfLines

See GetNumberOfLines

PreDrag

See GetPreDrag and SetPreDrag

Scale

See GetScale and SetScale

Selection

See GetSelection and SetSelection

SelectionAnchor

See GetSelectionAnchor and SetSelectionAnchor

SelectionAnchorObject

See GetSelectionAnchorObject and SetSelectionAnchorObject

SelectionRange

See GetSelectionRange and SetSelectionRange

StringSelection

See GetStringSelection

StyleSheet

See GetStyleSheet and SetStyleSheet

TextCursor

See GetTextCursor and SetTextCursor

URLCursor

See GetURLCursor and SetURLCursor

Value

See GetValue and SetValue

VerticalScrollbarEnabled

See GetVerticalScrollbarEnabled

VirtualAttributesEnabled

See GetVirtualAttributesEnabled


api Class API

class wx.richtext.RichTextCtrl(Control)

Possible constructors:

RichTextCtrl()

RichTextCtrl(parent, id=-1, value="", pos=DefaultPosition,
             size=DefaultSize, style=RE_MULTILINE, validator=DefaultValidator,
             name=TextCtrlNameStr)

RichTextCtrl provides a generic, ground-up implementation of a text control capable of showing multiple styles and images.


Methods

__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Default constructor.



__init__ (self, parent, id=-1, value=””, pos=DefaultPosition, size=DefaultSize, style=RE_MULTILINE, validator=DefaultValidator, name=TextCtrlNameStr)

Constructor, creating and showing a rich text control.

Parameters
  • parent (wx.Window) – Parent window. Must not be None.

  • id (wx.WindowID) – Window identifier. The value ID_ANY indicates a default value.

  • value (string) – Default string.

  • pos (wx.Point) – Window position.

  • size (wx.Size) – Window size.

  • style (long) – Window style.

  • validator (wx.Validator) – Window validator.

  • name (string) – Window name.

See also

Create , wx.Validator





AddImage(self, image)

Adds an image to the control’s buffer.

Parameters

image (wx.Image) –

Return type

wx.richtext.RichTextRange



AddParagraph(self, text)

Adds a new paragraph of text to the end of the buffer.

Parameters

text (string) –

Return type

wx.richtext.RichTextRange



AppendText(self, text)

Sets the insertion point to the end of the buffer and writes the text.

Parameters

text (string) –



ApplyAlignmentToSelection(self, alignment)

Applies the given alignment to the selection or the default style (undoable).

For alignment values, see wx.TextAttr.

Parameters

alignment (TextAttrAlignment) –

Return type

bool



ApplyBoldToSelection(self)

Apples bold to the selection or the default style (undoable).

Return type

bool



ApplyItalicToSelection(self)

Applies italic to the selection or the default style (undoable).

Return type

bool



ApplyStyle(self, styleDef)

Applies the style sheet to the buffer, matching paragraph styles in the sheet against named styles in the buffer.

This might be useful if the styles have changed. If sheet is None, the sheet set with SetStyleSheet is used. Currently this applies paragraph styles only.

Parameters

styleDef (wx.richtext.RichTextStyleDefinition) –

Return type

bool



ApplyStyleSheet(self, styleSheet=None)

Applies the style sheet to the buffer, for example if the styles have changed.

Parameters

styleSheet (wx.richtext.RichTextStyleSheet) –

Return type

bool



ApplyTextEffectToSelection(self, flags)

Applies one or more TextAttrEffects flags to the selection (undoable).

If there is no selection, it is applied to the default style.

Parameters

flags (int) –

Return type

bool



ApplyUnderlineToSelection(self)

Applies underline to the selection or the default style (undoable).

Return type

bool



AutoComplete(self, *args, **kw)

overload Overloaded Implementations:



AutoComplete (self, choices)

Call this function to enable auto-completion of the text typed in a single-line text control using the given choices.

Parameters

choices (list of strings) –

Return type

bool

Returns

True if the auto-completion was enabled or False if the operation failed, typically because auto-completion is not supported by the current platform.

New in version 2.9.0.



AutoComplete (self, completer)

Enable auto-completion using the provided completer object.

This method should be used instead of AutoComplete overload taking the array of possible completions if the total number of strings is too big as it allows returning the completions dynamically, depending on the text already entered by user and so is more efficient.

The specified completer object will be used to retrieve the list of possible completions for the already entered text and will be deleted by wx.TextEntry itself when it’s not needed any longer.

Notice that you need to include /textcompleter.h in order to define your class inheriting from wx.TextCompleter.

Parameters

completer (wx.TextCompleter) – The object to be used for generating completions if not None. If it is None, auto-completion is disabled. The wx.TextEntry object takes ownership of this pointer and will delete it in any case (i.e. even if this method returns False).

Return type

bool

Returns

True if the auto-completion was enabled or False if the operation failed, typically because auto-completion is not supported by the current platform.

New in version 2.9.2.





AutoCompleteDirectories(self)

Call this function to enable auto-completion of the text using the file system directories.

Unlike AutoCompleteFileNames which completes both file names and directories, this function only completes the directory names.

Notice that currently this function is only implemented in wxMSW port and does nothing under the other platforms.

Return type

bool

Returns

True if the auto-completion was enabled or False if the operation failed, typically because auto-completion is not supported by the current platform.

New in version 2.9.3.

See also

AutoComplete



AutoCompleteFileNames(self)

Call this function to enable auto-completion of the text typed in a single-line text control using all valid file system paths.

Notice that currently this function is only implemented in wxMSW port and does nothing under the other platforms.

Return type

bool

Returns

True if the auto-completion was enabled or False if the operation failed, typically because auto-completion is not supported by the current platform.

New in version 2.9.0.

See also

AutoComplete



BatchingUndo(self)

Returns True if undo commands are being batched.

Return type

bool



BeginAlignment(self, alignment)

Begins using alignment.

For alignment values, see wx.TextAttr.

Parameters

alignment (TextAttrAlignment) –

Return type

bool



BeginBatchUndo(self, cmdName)

Starts batching undo history for commands.

Parameters

cmdName (string) –

Return type

bool



BeginBold(self)

Begins using bold.

Return type

bool



BeginCharacterStyle(self, characterStyle)

Begins using the named character style.

Parameters

characterStyle (string) –

Return type

bool



BeginFont(self, font)

Begins using this font.

Parameters

font (wx.Font) –

Return type

bool



BeginFontSize(self, pointSize)

Begins using the given point size.

Parameters

pointSize (int) –

Return type

bool



BeginItalic(self)

Begins using italic.

Return type

bool



BeginLeftIndent(self, leftIndent, leftSubIndent=0)

Begins applying a left indent and subindent in tenths of a millimetre.

The subindent is an offset from the left edge of the paragraph, and is used for all but the first line in a paragraph. A positive value will cause the first line to appear to the left of the subsequent lines, and a negative value will cause the first line to be indented to the right of the subsequent lines.

wx.richtext.RichTextBuffer uses indentation to render a bulleted item. The content of the paragraph, including the first line, starts at the leftIndent plus the leftSubIndent.

Parameters
  • leftIndent (int) – The distance between the margin and the bullet.

  • leftSubIndent (int) – The distance between the left edge of the bullet and the left edge of the actual paragraph.

Return type

bool



BeginLineSpacing(self, lineSpacing)

Begins appling line spacing.

spacing is a multiple, where 10 means single-spacing, 15 means 1.5 spacing, and 20 means float spacing.

The wx.TextAttrLineSpacing constants are defined for convenience.

Parameters

lineSpacing (int) –

Return type

bool



BeginListStyle(self, listStyle, level=1, number=1)

Begins using a specified list style.

Optionally, you can also pass a level and a number.

Parameters
  • listStyle (string) –

  • level (int) –

  • number (int) –

Return type

bool



BeginNumberedBullet(self, bulletNumber, leftIndent, leftSubIndent, bulletStyle=TEXT_ATTR_BULLET_STYLE_ARABIC|TEXT_ATTR_BULLET_STYLE_PERIOD)

Begins a numbered bullet.

This call will be needed for each item in the list, and the application should take care of incrementing the numbering.

bulletNumber is a number, usually starting with 1. leftIndent and leftSubIndent are values in tenths of a millimetre. bulletStyle is a bitlist of the wx.TextAttrBulletStyle values.

wx.richtext.RichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between the margin and the bullet. The content of the paragraph, including the first line, starts at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the left of the actual paragraph is leftSubIndent.

Parameters
  • bulletNumber (int) –

  • leftIndent (int) –

  • leftSubIndent (int) –

  • bulletStyle (int) –

Return type

bool



BeginParagraphSpacing(self, before, after)

Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of a millimetre.

Parameters
  • before (int) –

  • after (int) –

Return type

bool



BeginParagraphStyle(self, paragraphStyle)

Begins applying the named paragraph style.

Parameters

paragraphStyle (string) –

Return type

bool



BeginRightIndent(self, rightIndent)

Begins a right indent, specified in tenths of a millimetre.

Parameters

rightIndent (int) –

Return type

bool



BeginStandardBullet(self, bulletName, leftIndent, leftSubIndent, bulletStyle=TEXT_ATTR_BULLET_STYLE_STANDARD)

Begins applying a symbol bullet.

Parameters
  • bulletName (string) –

  • leftIndent (int) –

  • leftSubIndent (int) –

  • bulletStyle (int) –

Return type

bool



BeginStyle(self, style)

Begins applying a style.

Parameters

style (wx.richtext.RichTextAttr) –

Return type

bool



BeginSuppressUndo(self)

Starts suppressing undo history for commands.

Return type

bool



BeginSymbolBullet(self, symbol, leftIndent, leftSubIndent, bulletStyle=TEXT_ATTR_BULLET_STYLE_SYMBOL)

Begins applying a symbol bullet, using a character from the current font.

See BeginNumberedBullet for an explanation of how indentation is used to render the bulleted paragraph.

Parameters
  • symbol (string) –

  • leftIndent (int) –

  • leftSubIndent (int) –

  • bulletStyle (int) –

Return type

bool



BeginTextColour(self, colour)

Begins using this colour.

Parameters

colour (wx.Colour) –

Return type

bool



BeginURL(self, url, characterStyle="")

Begins applying wx.TEXT_ATTR_URL to the content.

Pass a URL and optionally, a character style to apply, since it is common to mark a URL with a familiar style such as blue text with underlining.

Parameters
  • url (string) –

  • characterStyle (string) –

Return type

bool



BeginUnderline(self)

Begins using underlining.

Return type

bool



CanCopy(self)

Returns True if selected content can be copied to the clipboard.

Return type

bool



CanCut(self)

Returns True if selected content can be copied to the clipboard and deleted.

Return type

bool



CanDeleteRange(self, container, range)

Can we delete this range? Sends an event to the control.

Parameters
Return type

bool



CanDeleteSelection(self)

Returns True if selected content can be deleted.

Return type

bool



CanEditProperties(self, obj)

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

Parameters

obj (wx.richtext.RichTextObject) –

Return type

bool



CanInsertContent(self, container, pos)

Can we insert content at this position? Sends an event to the control.

Parameters
Return type

bool



CanPaste(self)

Returns True if the clipboard content can be pasted to the buffer.

Return type

bool



CanRedo(self)

Returns True if there is a command in the command history that can be redone.

Return type

bool



CanUndo(self)

Returns True if there is a command in the command history that can be undone.

Return type

bool



ChangeValue(self, value)

Sets the new text control value.

It also marks the control as not-modified which means that IsModified() would return False immediately after the call to ChangeValue .

The insertion point is set to the start of the control (i.e. position 0) by this function.

This functions does not generate the wxEVT_TEXT event but otherwise is identical to SetValue .

See User Generated Events vs Programmatically Generated Events for more information.

Parameters

value (string) – The new value to set. It may contain newline characters if the text control is multi-line.

New in version 2.7.1.



Clear(self)

Clears the buffer content, leaving a single empty paragraph.

Cannot be undone.



static ClearAvailableFontNames()

Clears the cache of available font names.



ClearListStyle(self, range, flags=RICHTEXT_SETSTYLE_WITH_UNDO)

Clears the list style from the given range, clearing list-related attributes and applying any named paragraph style associated with each paragraph.

flags is a bit list of the following:

  • wx.richtext.RICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.

Parameters
Return type

bool



Command(self, event)

Sends the event to the control.

Parameters

event (wx.CommandEvent) –



Copy(self)

Copies the selected content (if any) to the clipboard.



Create(self, parent, id=-1, value="", pos=DefaultPosition, size=DefaultSize, style=RE_MULTILINE, validator=DefaultValidator, name=TextCtrlNameStr)

Creates the underlying window.

Parameters
Return type

bool



Cut(self)

Copies the selected content (if any) to the clipboard and deletes the selection.

This is undoable.



Delete(self, range)

Deletes the content within the given range.

Parameters

range (wx.richtext.RichTextRange) –

Return type

bool



DeleteSelectedContent(self, newPos=None)

Deletes content if there is a selection, e.g.

when pressing a key. Returns the new caret position in newPos, or leaves it if there was no action. This is undoable.



DeleteSelection(self)

Deletes the content in the selection, if any.

This is undoable.



DiscardEdits(self)

Sets the buffer’s modified status to False, and clears the buffer’s command history.



DoGetBestSize(self)

Currently this simply returns wx.Size.

Return type

Size



DoGetValue(self)
Return type

string



DoLayoutBuffer(self, buffer, dc, context, rect, parentRect, flags)

Implements layout.

An application may override this to perform operations before or after layout.

Parameters


DoLoadFile(self, file, fileType)

Helper function for LoadFile .

Loads content into the control’s buffer using the given type.

If the specified type is wx.richtext.RICHTEXT_TYPE_ANY, the type is deduced from the filename extension.

This function looks for a suitable wx.richtext.RichTextFileHandler object.

Parameters
  • file (string) –

  • fileType (int) –

Return type

bool



DoSaveFile(self, file="", fileType=RICHTEXT_TYPE_ANY)

Helper function for SaveFile .

Saves the buffer content using the given type.

If the specified type is wx.richtext.RICHTEXT_TYPE_ANY, the type is deduced from the filename extension.

This function looks for a suitable wx.richtext.RichTextFileHandler object.

Parameters
  • file (string) –

  • fileType (int) –

Return type

bool



DoThaw(self)


DoWriteText(self, value, flags=0)
Parameters
  • value (string) –

  • flags (int) –



DoesSelectionHaveTextEffectFlag(self, flag)

Returns True if all of the selection, or the content at the current caret position, has the supplied TextAttrEffects flag(s).

Parameters

flag (int) –

Return type

bool



EditProperties(self, obj, parent)

Edits the object’s properties via a GUI.

Parameters
Return type

bool



EnableDelayedImageLoading(self, b)

Enable or disable delayed image loading.

Parameters

b (bool) –



EnableImages(self, b)

Enable or disable images.

Parameters

b (bool) –



EnableVerticalScrollbar(self, enable)

Enable or disable the vertical scrollbar.

Parameters

enable (bool) –



EnableVirtualAttributes(self, b)

Pass True to let the control use virtual attributes.

The default is False.

Parameters

b (bool) –



EndAlignment(self)

Ends alignment.

Return type

bool



EndAllStyles(self)

Ends application of all styles in the current style stack.

Return type

bool



EndBatchUndo(self)

Ends batching undo command history.

Return type

bool



EndBold(self)

Ends using bold.

Return type

bool



EndCharacterStyle(self)

Ends application of a named character style.

Return type

bool



EndFont(self)

Ends using a font.

Return type

bool



EndFontSize(self)

Ends using a point size.

Return type

bool



EndItalic(self)

Ends using italic.

Return type

bool



EndLeftIndent(self)

Ends left indent.

Return type

bool



EndLineSpacing(self)

Ends line spacing.

Return type

bool



EndListStyle(self)

Ends using a specified list style.

Return type

bool



EndNumberedBullet(self)

Ends application of a numbered bullet.

Return type

bool



EndParagraphSpacing(self)

Ends paragraph spacing.

Return type

bool



EndParagraphStyle(self)

Ends application of a named paragraph style.

Return type

bool



EndRightIndent(self)

Ends right indent.

Return type

bool



EndStandardBullet(self)

Begins applying a standard bullet.

Return type

bool



EndStyle(self)

Ends the current style.

Return type

bool



EndSuppressUndo(self)

Ends suppressing undo command history.

Return type

bool



EndSymbolBullet(self)

Ends applying a symbol bullet.

Return type

bool



EndTextColour(self)

Ends applying a text colour.

Return type

bool



EndURL(self)

Ends applying a URL.

Return type

bool



EndUnderline(self)

End applying underlining.

Return type

bool



ExtendCellSelection(self, table, noRowSteps, noColSteps)

Extends a table selection in the given direction.

Parameters
Return type

bool



ExtendSelection(self, oldPosition, newPosition, flags)

Helper function for extending the selection, returning True if the selection was changed.

Selections are in caret positions.

Parameters
  • oldPosition (long) –

  • newPosition (long) –

  • flags (int) –

Return type

bool



FindCaretPositionForCharacterPosition(self, position, hitTestFlags, container, caretLineStart)

Find the caret position for the combination of hit-test flags and character position.

Returns the caret position and also an indication of where to place the caret (caretLineStart) since this is ambiguous (same position used for end of line and start of next).

Parameters
Return type

long



FindContainerAtPoint(self, pt, position, hit, hitObj, flags=0)

Finds the container at the given point, which is assumed to be in client coordinates.

Parameters
Return type

wx.richtext.RichTextParagraphLayoutBox



FindNextWordPosition(self, direction=1)

Helper function for finding the caret position for the next word.

Direction is 1 (forward) or -1 (backwards).

Parameters

direction (int) –

Return type

long



FindRangeForList(self, pos, isNumberedList)

Given a character position at which there is a list style, find the range encompassing the same list style by looking backwards and forwards.

Parameters
  • pos (long) –

  • isNumberedList (bool) –

Return type

wx.richtext.RichTextRange



ForceDelayedLayout(self)


ForceUpper(self)

Convert all text entered into the control to upper case.

Call this method to ensure that all text entered into the control is converted on the fly to upper case. If the control is not empty, its existing contents is also converted to upper case.

New in version 4.1/wxWidgets-3.1.0.



GetAdjustedCaretPosition(self, caretPos)

The adjusted caret position is the character position adjusted to take into account whether we’re at the start of a paragraph, in which case style information should be taken from the next position, not current one.

Parameters

caretPos (long) –

Return type

long



static GetAvailableFontNames()

Font names take a long time to retrieve, so cache them (on demand).

Return type

list of strings



GetBasicStyle(self)

Gets the basic (overall) style.

This is the style of the whole buffer before further styles are applied, unlike the default style, which only affects the style currently being applied (for example, setting the default style to bold will cause subsequently inserted text to be bold).

Return type

wx.richtext.RichTextAttr



GetBuffer(self)

Returns the buffer associated with the control.

Return type

wx.richtext.RichTextBuffer



GetCaretAtLineStart(self)

Returns True if we are showing the caret position at the start of a line instead of at the end of the previous one.

Return type

bool



GetCaretPosition(self)

Returns the current caret position.

Return type

long



GetCaretPositionForDefaultStyle(self)

Returns the caret position since the default formatting was changed.

As soon as this position changes, we no longer reflect the default style in the UI. A value of -2 means that we should only reflect the style of the content under the caret.

Return type

long



GetCaretPositionForIndex(self, position, rect, container=None)

Returns the caret height and position for the given character position.

If container is null, the current focus object will be used.



static GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)
Parameters

variant (WindowVariant) –

Return type

VisualAttributes



GetCommandProcessor(self)

Gets the command processor associated with the control’s buffer.

Return type

CommandProcessor



GetContextMenu(self)

Returns the current context menu.

Return type

Menu



GetContextMenuPropertiesInfo(self)

Returns an object that stores information about context menu property item(s), in order to communicate between the context menu event handler and the code that responds to it.

The wx.richtext.RichTextContextMenuPropertiesInfo stores one item for each object that could respond to a property-editing event. If objects are nested, several might be editable.

Return type

wx.richtext.RichTextContextMenuPropertiesInfo



GetDefaultStyleEx(self)

Returns the current default style, which can be used to change how subsequently inserted text is displayed.

Return type

wx.richtext.RichTextAttr



GetDelayedImageLoading(self)

Returns True if delayed image loading is enabled.

Return type

bool



GetDelayedImageProcessingRequired(self)

Gets the flag indicating that delayed image processing is required.

Return type

bool



GetDelayedImageProcessingTime(self)

Returns the last time delayed image processing was performed.

Return type

long



GetDelayedLayoutThreshold(self)

Gets the size of the buffer beyond which layout is delayed during resizing.

This optimizes sizing for large buffers. The default is 20000.

Return type

long



GetDimensionScale(self)

Returns the scale factor for displaying certain dimensions such as indentation and inter-paragraph spacing.

Return type

float



GetDragStartPoint(self)

Get the possible Drag’n’Drop start point.

Return type

Point



GetDragStartTime(self)

Get the possible Drag’n’Drop start time.

Return type

DateTime



GetDragging(self)

Returns True if we are extending a selection.

Return type

bool



GetFilename(self)

Gets the current filename associated with the control.

Return type

string



GetFirstVisiblePoint(self)

Returns the first visible point in the window.

Return type

Point



GetFirstVisiblePosition(self)

Returns the first visible position in the current view.

Return type

long



GetFocusObject(self)

Returns the wx.richtext.RichTextObject object that currently has the editing focus.

If there are no composite objects, this will be the top-level buffer.

Return type

wx.richtext.RichTextParagraphLayoutBox



GetFontScale(self)

Returns the scale factor for displaying fonts, for example for more comfortable editing.

Return type

float



GetFullLayoutRequired(self)
Return type

bool



GetFullLayoutSavedPosition(self)
Return type

long



GetFullLayoutTime(self)
Return type

long



GetHandlerFlags(self)

Returns flags that change the behaviour of loading or saving.

See the documentation for each handler class to see what flags are relevant for each handler.

Return type

int



GetHint(self)

Returns the current hint string.

See SetHint for more information about hints.

Return type

string

New in version 2.9.0.



GetImagesEnabled(self)

Returns True if images are enabled.

Return type

bool



GetInsertionPoint(self)

Returns the current insertion point.

Return type

long



GetInternalSelectionRange(self)

Returns the selection range in character positions.

-2, -2 means no selection -1, -1 means select everything. The range is in internal format, i.e. a single character selection is denoted by (n, n)

Return type

wx.richtext.RichTextRange



GetLastPosition(self)

Returns the last position in the buffer.

Return type

wx.TextPos



GetLineLength(self, lineNo)

Returns the length of the specified line in characters.

Parameters

lineNo (long) –

Return type

int



GetLineText(self, lineNo)

Returns the text for the given line.

Parameters

lineNo (long) –

Return type

string



GetLogicalPoint(self, ptPhysical)

Transforms physical window position to logical (unscrolled) position.

Parameters

ptPhysical (wx.Point) –

Return type

Point



GetMargins(self)

Returns the margins used by the control.

The x field of the returned point is the horizontal margin and the y field is the vertical one.

Return type

wx.Point

New in version 2.9.1.

Note

If given margin cannot be accurately determined, its value will be set to -1. On some platforms you cannot obtain valid margin values until you have called SetMargins .

See also

SetMargins



GetNumberOfLines(self)

Returns the number of lines in the buffer.

Return type

int



GetPhysicalPoint(self, ptLogical)

Transforms logical (unscrolled) position to physical window position.

Parameters

ptLogical (wx.Point) –

Return type

Point



GetPreDrag(self)

Are we trying to start Drag’n’Drop?

Return type

bool



GetPropertiesMenuLabel(self, obj)

Gets the object’s properties menu label.

Parameters

obj (wx.richtext.RichTextObject) –

Return type

string



GetRange(self, from_, to_)

Gets the text for the given range.

The end point of range is specified as the last character position of the span of text, plus one.

Parameters
  • from_ (long) –

  • to_ (long) –

Return type

string



GetScale(self)

Returns an overall scale factor for displaying and editing the content.

Return type

float



GetScaledPoint(self, pt)

Returns a scaled point.

Parameters

pt (wx.Point) –

Return type

Point



GetScaledRect(self, rect)

Returns a scaled rectangle.

Parameters

rect (wx.Rect) –

Return type

Rect



GetScaledSize(self, sz)

Returns a scaled size.

Parameters

sz (wx.Size) –

Return type

Size



GetSelection(self)

Returns the range of the current selection.

The end point of range is specified as the last character position of the span of text, plus one. If the return values from and to are the same, there is no selection.

Return type

wx.richtext.RichTextSelection



GetSelectionAnchor(self)

Returns an anchor so we know how to extend the selection.

It’s a caret position since it’s between two characters.

Return type

long



GetSelectionAnchorObject(self)

Returns the anchor object if selecting multiple containers.

Return type

wx.richtext.RichTextObject



GetSelectionRange(self)

Returns the selection range in character positions.

-1, -1 means no selection.

The range is in API convention, i.e. a single character selection is denoted by (n, n+1)

Return type

wx.richtext.RichTextRange



GetStringSelection(self)

Returns the text within the current selection range, if any.

Return type

string



GetStyle(self, *args, **kw)

Gets the attributes at the given position.

This function gets the combined style - that is, the style you see on the screen as a result of combining base style, paragraph style and character style attributes.

To get the character or paragraph style alone, use GetUncombinedStyle .



GetStyleForRange(self, *args, **kw)

Gets the attributes common to the specified range.

Attributes that differ in value within the range will not be included in style flags.



GetStyleSheet(self)

Returns the style sheet associated with the control, if any.

A style sheet allows named character and paragraph styles to be applied.

Return type

wx.richtext.RichTextStyleSheet



GetTextCursor(self)

Returns the text (normal) cursor.

Return type

Cursor



GetURLCursor(self)

Returns the cursor to be used over URLs.

Return type

Cursor



GetUncombinedStyle(self, *args, **kw)

Gets the attributes at the given position.

This function gets the uncombined style - that is, the attributes associated with the paragraph or character content, and not necessarily the combined attributes you see on the screen. To get the combined attributes, use GetStyle .

If you specify (any) paragraph attribute in style’s flags, this function will fetch the paragraph attributes. Otherwise, it will return the character attributes.



GetUnscaledPoint(self, pt)

Returns an unscaled point.

Parameters

pt (wx.Point) –

Return type

Point



GetUnscaledRect(self, rect)

Returns an unscaled rectangle.

Parameters

rect (wx.Rect) –

Return type

Rect



GetUnscaledSize(self, sz)

Returns an unscaled size.

Parameters

sz (wx.Size) –

Return type

Size



GetValue(self)

Returns the content of the entire control as a string.

Return type

string



GetVerticalScrollbarEnabled(self)

Returns True if the vertical scrollbar is enabled.

Return type

bool



GetVirtualAttributesEnabled(self)

Returns True if this control can use virtual attributes and virtual text.

The default is False.

Return type

bool



GetVisibleLineForCaretPosition(self, caretPosition)

Internal helper function returning the line for the visible caret position.

If the caret is shown at the very end of the line, it means the next character is actually on the following line. So this function gets the line we’re expecting to find if this is the case.

Parameters

caretPosition (long) –

Return type

wx.richtext.RichTextLine



HasCharacterAttributes(self, range, style)

Test if this whole range has character attributes of the specified kind.

If any of the attributes are different within the range, the test fails.

You can use this to implement, for example, bold button updating. style must have flags indicating which attributes are of interest.

Parameters
Return type

bool



HasParagraphAttributes(self, range, style)

Test if this whole range has paragraph attributes of the specified kind.

If any of the attributes are different within the range, the test fails. You can use this to implement, for example, centering button updating. style must have flags indicating which attributes are of interest.

Parameters
Return type

bool



HasSelection(self)

Returns True if there is a selection and the object containing the selection was the same as the current focus object.

Return type

bool



HasUnfocusedSelection(self)

Returns True if there was a selection, whether or not the current focus object is the same as the selection’s container object.

Return type

bool



HitTest(self, pt)

Finds the character at the given position in pixels.

pt is in device coords (not adjusted for the client area origin nor for scrolling).

Parameters

pt (wx.Point) –

Return type

tuple

Returns

( wx.TextCtrlHitTestResult, pos )



HitTestXY(self, pt)

Finds the character at the given position in pixels.

pt is in device coords (not adjusted for the client area origin nor for scrolling).

Parameters

pt (wx.Point) –

Return type

tuple

Returns

( wx.TextCtrlHitTestResult, col, row )



Init(self)

Initialises the members of the control.



Invalidate(self)

Invalidates the whole buffer to trigger painting later.



IsDefaultStyleShowing(self)

Returns True if the user has recently set the default style without moving the caret, and therefore the UI needs to reflect the default style and not the style at the caret.

Below is an example of code that uses this function to determine whether the UI should show that the current style is bold.

Return type

bool



IsEditable(self)

Returns True if the control is editable.

Return type

bool



IsEmpty(self)

Returns True if the control is currently empty.

This is the same as GetValue .empty() but can be much more efficient for the multiline controls containing big amounts of text.

Return type

bool

New in version 2.7.1.



IsModified(self)

Returns True if the buffer has been modified.

Return type

bool



IsMultiLine(self)

Returns True if the control is multiline.

Return type

bool



IsPositionVisible(self, pos)

Returns True if the given position is visible on the screen.

Parameters

pos (long) –

Return type

bool



IsSelectionAligned(self, alignment)

Returns True if all of the selection is aligned according to the specified flag.

Parameters

alignment (TextAttrAlignment) –

Return type

bool



IsSelectionBold(self)

Returns True if all of the selection, or the content at the caret position, is bold.

Return type

bool



IsSelectionItalics(self)

Returns True if all of the selection, or the content at the caret position, is italic.

Return type

bool



IsSelectionUnderlined(self)

Returns True if all of the selection, or the content at the caret position, is underlined.

Return type

bool



IsSingleLine(self)

Returns True if the control is single-line.

Currently wx.richtext.RichTextCtrl does not support single-line editing.

Return type

bool



KeyboardNavigate(self, keyCode, flags)

Helper function implementing keyboard navigation.

Parameters
  • keyCode (int) –

  • flags (int) –

Return type

bool



LayoutContent(self, onlyVisibleRect=False)

Lays out the buffer, which must be done before certain operations, such as setting the caret position.

This function should not normally be required by the application.

Parameters

onlyVisibleRect (bool) –

Return type

bool



LineBreak(self)

Inserts a line break at the current insertion point.

A line break forces wrapping within a paragraph, and can be introduced by using this function, by appending the Char value RichTextLineBreakChar to text content, or by typing Shift-Return.

Return type

bool



LoadFile(self, file, type=RICHTEXT_TYPE_ANY)

Loads content into the control’s buffer using the given type.

If the specified type is wx.richtext.RICHTEXT_TYPE_ANY, the type is deduced from the filename extension.

This function looks for a suitable wx.richtext.RichTextFileHandler object.

Parameters
  • file (string) –

  • type (int) –

Return type

bool



MarkDirty(self)

Marks the buffer as modified.



MoveCaret(self, pos, showAtLineStart=False, container=None)

Move the caret to the given character position.

Please note that this does not update the current editing style from the new position; to do that, call wx.richtext.RichTextCtrl.SetInsertionPoint instead.

Parameters
Return type

bool



MoveCaretBack(self, oldPosition)

Move the caret one visual step forward: this may mean setting a flag and keeping the same position if we’re going from the end of one line to the start of the next, which may be the exact same caret position.

Parameters

oldPosition (long) –



MoveCaretForward(self, oldPosition)

Move the caret one visual step forward: this may mean setting a flag and keeping the same position if we’re going from the end of one line to the start of the next, which may be the exact same caret position.

Parameters

oldPosition (long) –



MoveDown(self, noLines=1, flags=0)

Moves the caret down.

Parameters
  • noLines (int) –

  • flags (int) –

Return type

bool



MoveEnd(self, flags=0)

Moves to the end of the buffer.

Parameters

flags (int) –

Return type

bool



MoveHome(self, flags=0)

Moves to the start of the buffer.

Parameters

flags (int) –

Return type

bool



MoveLeft(self, noPositions=1, flags=0)

Moves left.

Parameters
  • noPositions (int) –

  • flags (int) –

Return type

bool



MoveRight(self, noPositions=1, flags=0)

Moves right.

Parameters
  • noPositions (int) –

  • flags (int) –

Return type

bool



MoveToLineEnd(self, flags=0)

Moves to the end of the line.

Parameters

flags (int) –

Return type

bool



MoveToLineStart(self, flags=0)

Moves to the start of the line.

Parameters

flags (int) –

Return type

bool



MoveToParagraphEnd(self, flags=0)

Moves to the end of the paragraph.

Parameters

flags (int) –

Return type

bool



MoveToParagraphStart(self, flags=0)

Moves to the start of the paragraph.

Parameters

flags (int) –

Return type

bool



MoveUp(self, noLines=1, flags=0)

Moves to the start of the paragraph.

Parameters
  • noLines (int) –

  • flags (int) –

Return type

bool



Newline(self)

Inserts a new paragraph at the current insertion point.

Return type

bool

See also

LineBreak .



NumberList(self, *args, **kw)

Numbers the paragraphs in the given range.

Pass flags to determine how the attributes are set.

Either the style definition or the name of the style definition (in the current sheet) can be passed.

flags is a bit list of the following:

  • wx.richtext.RICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.

  • wx.richtext.RICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from startFrom, otherwise existing attributes are used.

  • wx.richtext.RICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that listLevel should be used as the level for all paragraphs, otherwise the current indentation will be used.

overload Overloaded Implementations:



NumberList (self, range, def=None, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)

Parameters
Return type

bool



NumberList (self, range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)

Parameters
Return type

bool





OnCaptureLost(self, event)
Parameters

event (wx.MouseCaptureLostEvent) –



OnChar(self, event)
Parameters

event (wx.KeyEvent) –



OnClear(self, event)

Standard handler for the wx.ID_CLEAR command.

Parameters

event (wx.CommandEvent) –



OnContextMenu(self, event)

Shows a standard context menu with undo, redo, cut, copy, paste, clear, and select all commands.

Parameters

event (wx.ContextMenuEvent) –



OnCopy(self, event)

Standard handler for the wx.ID_COPY command.

Parameters

event (wx.CommandEvent) –



OnCut(self, event)

Standard handler for the wx.ID_CUT command.

Parameters

event (wx.CommandEvent) –



OnDropFiles(self, event)

Loads the first dropped file.

Parameters

event (wx.DropFilesEvent) –



OnEraseBackground(self, event)
Parameters

event (wx.EraseEvent) –



OnIdle(self, event)
Parameters

event (wx.IdleEvent) –



OnKillFocus(self, event)
Parameters

event (wx.FocusEvent) –



OnLeftClick(self, event)
Parameters

event (wx.MouseEvent) –



OnLeftDClick(self, event)
Parameters

event (wx.MouseEvent) –



OnLeftUp(self, event)
Parameters

event (wx.MouseEvent) –



OnMiddleClick(self, event)
Parameters

event (wx.MouseEvent) –



OnMoveMouse(self, event)
Parameters

event (wx.MouseEvent) –



OnPaint(self, event)
Parameters

event (wx.PaintEvent) –



OnPaste(self, event)

Standard handler for the wx.ID_PASTE command.

Parameters

event (wx.CommandEvent) –



OnProperties(self, event)

Standard handler for property commands.

Parameters

event (wx.CommandEvent) –



OnRedo(self, event)

Standard handler for the wx.ID_REDO command.

Parameters

event (wx.CommandEvent) –



OnRightClick(self, event)
Parameters

event (wx.MouseEvent) –



OnScroll(self, event)
Parameters

event (wx.ScrollWinEvent) –



OnSelectAll(self, event)

Standard handler for the wx.ID_SELECTALL command.

Parameters

event (wx.CommandEvent) –



OnSetFocus(self, event)
Parameters

event (wx.FocusEvent) –



OnSize(self, event)
Parameters

event (wx.SizeEvent) –



OnSysColourChanged(self, event)
Parameters

event (wx.SysColourChangedEvent) –



OnTimer(self, event)

Respond to timer events.

Parameters

event (wx.TimerEvent) –



OnUndo(self, event)

Standard handler for the wx.ID_UNDO command.

Parameters

event (wx.CommandEvent) –



OnUpdateClear(self, event)

Standard update handler for the wx.ID_CLEAR command.

Parameters

event (wx.UpdateUIEvent) –



OnUpdateCopy(self, event)

Standard update handler for the wx.ID_COPY command.

Parameters

event (wx.UpdateUIEvent) –



OnUpdateCut(self, event)

Standard update handler for the wx.ID_CUT command.

Parameters

event (wx.UpdateUIEvent) –



OnUpdatePaste(self, event)

Standard update handler for the wx.ID_PASTE command.

Parameters

event (wx.UpdateUIEvent) –



OnUpdateProperties(self, event)

Standard update handler for property commands.

Parameters

event (wx.UpdateUIEvent) –



OnUpdateRedo(self, event)

Standard update handler for the wx.ID_REDO command.

Parameters

event (wx.UpdateUIEvent) –



OnUpdateSelectAll(self, event)

Standard update handler for the wx.ID_SELECTALL command.

Parameters

event (wx.UpdateUIEvent) –



OnUpdateUndo(self, event)

Standard update handler for the wx.ID_UNDO command.

Parameters

event (wx.UpdateUIEvent) –



PageDown(self, noPages=1, flags=0)

Moves one or more pages down.

Parameters
  • noPages (int) –

  • flags (int) –

Return type

bool



PageUp(self, noPages=1, flags=0)

Moves one or more pages up.

Parameters
  • noPages (int) –

  • flags (int) –

Return type

bool



PaintAboveContent(self, WXUNUSED)

Other user defined painting after everything else (i.e. all text) is painted.

Parameters

WXUNUSED (wx.DC) –

New in version 2.9.1.



PaintBackground(self, dc)

Paints the background.

Parameters

dc (wx.DC) –



Paste(self)

Pastes content from the clipboard to the buffer.



PopStyleSheet(self)

Pops the style sheet from top of stack.

Return type

wx.richtext.RichTextStyleSheet



PositionCaret(self, container=None)

Internal function to position the visible caret according to the current caret position.

Parameters

container (wx.richtext.RichTextParagraphLayoutBox) –



PositionToXY(self, pos)

Converts a text position to zero-based column and line numbers.

Parameters

pos (long) –

Return type

tuple

Returns

( bool, x, y )



PrepareContent(self, container)

Prepares the content just before insertion (or after buffer reset).

Called by the same function in wx.richtext.RichTextBuffer. Currently is only called if undo mode is on.

Parameters

container (wx.richtext.RichTextParagraphLayoutBox) –



PrepareContextMenu(self, menu, pt, addPropertyCommands)

Prepares the context menu, optionally adding appropriate property-editing commands.

Returns the number of property commands added.

Parameters
Return type

int



ProcessBackKey(self, event, flags)

Processes the back key.

Parameters
Return type

bool



ProcessDelayedImageLoading(self, *args, **kw)

overload Overloaded Implementations:



ProcessDelayedImageLoading (self, refresh)

Do delayed image loading and garbage-collect other images.

Parameters

refresh (bool) –

Return type

bool



ProcessDelayedImageLoading (self, screenRect, box, loadCount)

Parameters
Return type

bool





ProcessMouseMovement(self, container, obj, position, pos)

Processes mouse movement in order to change the cursor.

Parameters
Return type

bool



PromoteList(self, *args, **kw)

Promotes or demotes the paragraphs in the given range.

A positive promoteBy produces a smaller indent, and a negative number produces a larger indent. Pass flags to determine how the attributes are set. Either the style definition or the name of the style definition (in the current sheet) can be passed.

flags is a bit list of the following:

  • wx.richtext.RICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.

  • wx.richtext.RICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from startFrom, otherwise existing attributes are used.

  • wx.richtext.RICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that listLevel should be used as the level for all paragraphs, otherwise the current indentation will be used.

See also

SetListStyle ,

overload Overloaded Implementations:



PromoteList (self, promoteBy, range, def=None, flags=RICHTEXT_SETSTYLE_WITH_UNDO, specifiedLevel=-1)

Parameters
Return type

bool



PromoteList (self, promoteBy, range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, specifiedLevel=-1)

Parameters
Return type

bool





PushStyleSheet(self, styleSheet)

Push the style sheet to top of stack.

Parameters

styleSheet (wx.richtext.RichTextStyleSheet) –

Return type

bool



Redo(self)

Redoes the current command.



RefreshForSelectionChange(self, oldSelection, newSelection)

Refreshes the area affected by a selection change.

Parameters
Return type

bool



Remove(self, from_, to_)

Removes the content in the specified range.

Parameters
  • from_ (long) –

  • to_ (long) –



Replace(self, from_, to_, value)

Replaces the content in the specified range with the string specified by value.

Parameters
  • from_ (long) –

  • to_ (long) –

  • value (string) –



RequestDelayedImageProcessing(self)

Request delayed image processing.



SaveFile(self, file="", type=RICHTEXT_TYPE_ANY)

Saves the buffer content using the given type.

If the specified type is wx.richtext.RICHTEXT_TYPE_ANY, the type is deduced from the filename extension.

This function looks for a suitable wx.richtext.RichTextFileHandler object.

Parameters
  • file (string) –

  • type (int) –

Return type

bool



ScrollIntoView(self, position, keyCode)

Scrolls position into view.

This function takes a caret position.

Parameters
  • position (long) –

  • keyCode (int) –

Return type

bool



SelectAll(self)

Selects all the text in the buffer.



SelectNone(self)

Cancels any selection.



SelectWord(self, position)

Selects the word at the given character position.

Parameters

position (long) –

Return type

bool



SetAndShowDefaultStyle(self, attr)

Sets attr as the default style and tells the control that the UI should reflect this attribute until the user moves the caret.

Parameters

attr (wx.richtext.RichTextAttr) –



SetBasicStyle(self, style)

Sets the basic (overall) style.

This is the style of the whole buffer before further styles are applied, unlike the default style, which only affects the style currently being applied (for example, setting the default style to bold will cause subsequently inserted text to be bold).

Parameters

style (wx.richtext.RichTextAttr) –



SetCaretAtLineStart(self, atStart)

Sets a flag to remember that we are showing the caret position at the start of a line instead of at the end of the previous one.

Parameters

atStart (bool) –



SetCaretPosition(self, position, showAtLineStart=False)

Sets the caret position.

The caret position is the character position just before the caret. A value of -1 means the caret is at the start of the buffer. Please note that this does not update the current editing style from the new position or cause the actual caret to be refreshed; to do that, call wx.richtext.RichTextCtrl.SetInsertionPoint instead.

Parameters
  • position (long) –

  • showAtLineStart (bool) –



SetCaretPositionAfterClick(self, container, position, hitTestFlags, extendSelection=False)

Sets up the caret for the given position and container, after a mouse click.

Parameters
Return type

bool



SetCaretPositionForDefaultStyle(self, pos)

Set the caret position for the default style that the user is selecting.

Parameters

pos (long) –



SetContextMenu(self, menu)

Sets the current context menu.

Parameters

menu (wx.Menu) –



SetDefaultStyle(self, *args, **kw)

Sets the current default style, which can be used to change how subsequently inserted text is displayed.

overload Overloaded Implementations:



SetDefaultStyle (self, style)

Parameters

style (wx.TextAttr) –

Return type

bool



SetDefaultStyle (self, style)

Parameters

style (wx.richtext.RichTextAttr) –

Return type

bool





SetDefaultStyleToCursorStyle(self)

Sets the default style to the style under the cursor.

Return type

bool



SetDelayedImageProcessingRequired(self, b)

Sets the flag indicating that delayed image processing is required.

Parameters

b (bool) –



SetDelayedImageProcessingTime(self, t)

Sets the last time delayed image processing was performed.

Parameters

t (long) –



SetDelayedLayoutThreshold(self, threshold)

Sets the size of the buffer beyond which layout is delayed during resizing.

This optimizes sizing for large buffers. The default is 20000.

Parameters

threshold (long) –



SetDimensionScale(self, dimScale, refresh=False)

Sets the scale factor for displaying certain dimensions such as indentation and inter-paragraph spacing.

This can be useful when editing in a small control where you still want legible text, but a minimum of wasted white space.

Parameters
  • dimScale (float) –

  • refresh (bool) –



SetDragStartPoint(self, sp)

Set the possible Drag’n’Drop start point.

Parameters

sp (wx.Point) –



SetDragStartTime(self, st)

Set the possible Drag’n’Drop start time.

Parameters

st (wx.DateTime) –



SetDragging(self, dragging)

Sets a flag to remember if we are extending a selection.

Parameters

dragging (bool) –



SetEditable(self, editable)

Makes the control editable, or not.

Parameters

editable (bool) –



SetFilename(self, filename)

Sets the current filename.

Parameters

filename (string) –



SetFocusObject(self, obj, setCaretPosition=True)

Sets the wx.richtext.RichTextObject object that currently has the editing focus.

Parameters
Return type

bool



SetFont(self, font)

Sets the font, and also the basic and default attributes (see wx.richtext.RichTextCtrl.SetDefaultStyle ).

Parameters

font (wx.Font) –

Return type

bool



SetFontScale(self, fontScale, refresh=False)

Sets the scale factor for displaying fonts, for example for more comfortable editing.

Parameters
  • fontScale (float) –

  • refresh (bool) –



SetFullLayoutRequired(self, b)
Parameters

b (bool) –



SetFullLayoutSavedPosition(self, p)
Parameters

p (long) –



SetFullLayoutTime(self, t)
Parameters

t (long) –



SetHandlerFlags(self, flags)

Sets flags that change the behaviour of loading or saving.

See the documentation for each handler class to see what flags are relevant for each handler.

Parameters

flags (int) –



SetHint(self, hint)

Sets a hint shown in an empty unfocused text control.

The hints are usually used to indicate to the user what is supposed to be entered into the given entry field, e.g. a common use of them is to show an explanation of what can be entered in a wx.SearchCtrl.

The hint is shown (usually greyed out) for an empty control until it gets focus and is shown again if the control loses it and remains empty. It won’t be shown once the control has a non-empty value, although it will be shown again if the control contents is cleared. Because of this, it generally only makes sense to use hints with the controls which are initially empty.

Notice that hints are known as cue banners under MSW or placeholder strings under OS X.

For the platforms without native hints support, the implementation has several known limitations. Notably, the hint display will not be properly updated if you change wx.TextEntry contents programmatically when the hint is displayed using methods other than SetValue or ChangeValue or others which use them internally (e.g. Clear ). In other words, currently you should avoid calling methods such as WriteText or Replace when using hints and the text control is empty. If you bind to the control’s focus and wxEVT_TEXT events, you must call wx.Event.Skip on them so that the generic implementation works correctly.

Another limitation is that hints are ignored for the controls with TE_PASSWORD style.

Parameters

hint (string) –

Return type

bool

New in version 2.9.0.

Note

Currently implemented natively on Windows (Vista and later only), OS X and GTK+ (3.2 and later).

Note

Hints can be used for single line text controls under all platforms, but only MSW and GTK+ 2 support them for multi-line text controls, they are ignored for them under the other platforms.



SetInsertionPoint(self, pos)

Sets the insertion point and causes the current editing style to be taken from the new position (unlike wx.richtext.RichTextCtrl.SetCaretPosition ).

Parameters

pos (long) –



SetInsertionPointEnd(self)

Sets the insertion point to the end of the text control.



SetInternalSelectionRange(self, range)

Sets the selection range in character positions.

-2, -2 means no selection -1, -1 means select everything. The range is in internal format, i.e. a single character selection is denoted by (n, n)

Parameters

range (wx.richtext.RichTextRange) –



SetListStyle(self, *args, **kw)

Sets the list attributes for the given range, passing flags to determine how the attributes are set.

Either the style definition or the name of the style definition (in the current sheet) can be passed. flags is a bit list of the following:

  • wx.richtext.RICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.

  • wx.richtext.RICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from startFrom, otherwise existing attributes are used.

  • wx.richtext.RICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that listLevel should be used as the level for all paragraphs, otherwise the current indentation will be used.

overload Overloaded Implementations:



SetListStyle (self, range, styleDef, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)

Parameters
Return type

bool



SetListStyle (self, range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1)

Parameters
Return type

bool





SetMargins(self, *args, **kw)

Attempts to set the control margins.

When margins are given as wx.Point, x indicates the left and y the top margin. Use -1 to indicate that an existing value should be used.

Returns

True if setting of all requested margins was successful.

New in version 2.9.1.

overload Overloaded Implementations:



SetMargins (self, pt)

Parameters

pt (wx.Point) –

Return type

bool



SetMargins (self, left, top=-1)

Parameters
  • left (int) –

  • top (int) –

Return type

bool





SetMaxLength(self, len)

Sets the maximum number of characters that may be entered in a single line text control.

For compatibility only; currently does nothing.

Parameters

len (long) –



SetModified(self, modified)
Parameters

modified (bool) –



SetPreDrag(self, pd)

Set if we’re trying to start Drag’n’Drop.

Parameters

pd (bool) –



SetProperties(self, range, properties, flags=RICHTEXT_SETPROPERTIES_WITH_UNDO)

Sets the properties for the given range, passing flags to determine how the attributes are set.

You can merge properties or replace them.

The end point of range is specified as the last character position of the span of text, plus one. So, for example, to set the properties for a character at position 5, use the range (5,6).

flags may contain a bit list of the following values:

  • RICHTEXT_SETSPROPERTIES_NONE: no flag.

  • wx.richtext.RICHTEXT_SETPROPERTIES_WITH_UNDO: specifies that this operation should be undoable.

  • wx.richtext.RICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY: specifies that the properties should only be applied to paragraphs, and not the content.

  • wx.richtext.RICHTEXT_SETPROPERTIES_CHARACTERS_ONLY: specifies that the properties should only be applied to characters, and not the paragraph.

  • wx.richtext.RICHTEXT_SETPROPERTIES_RESET: resets (clears) the existing properties before applying the new properties.

  • wx.richtext.RICHTEXT_SETPROPERTIES_REMOVE: removes the specified properties.

Parameters
Return type

bool



SetScale(self, scale, refresh=False)

Sets an overall scale factor for displaying and editing the content.

Parameters
  • scale (float) –

  • refresh (bool) –



SetSelection(self, *args, **kw)

Sets the selection to the given range.

The end point of range is specified as the last character position of the span of text, plus one.

So, for example, to set the selection for a character at position 5, use the range (5,6).

overload Overloaded Implementations:



SetSelection (self, from_, to_)

Parameters
  • from_ (long) –

  • to_ (long) –



SetSelection (self, sel)

Parameters

sel (wx.richtext.RichTextSelection) –





SetSelectionAnchor(self, anchor)

Sets an anchor so we know how to extend the selection.

It’s a caret position since it’s between two characters.

Parameters

anchor (long) –



SetSelectionAnchorObject(self, anchor)

Sets the anchor object if selecting multiple containers.

Parameters

anchor (wx.richtext.RichTextObject) –



SetSelectionRange(self, range)

Sets the selection to the given range.

The end point of range is specified as the last character position of the span of text, plus one.

So, for example, to set the selection for a character at position 5, use the range (5,6).

Parameters

range (wx.richtext.RichTextRange) –



SetStyle(self, *args, **kw)

overload Overloaded Implementations:



SetStyle (self, start, end, style)

Sets the attributes for the given range.

The end point of range is specified as the last character position of the span of text, plus one.

So, for example, to set the style for a character at position 5, use the range (5,6).

Parameters
  • start (long) –

  • end (long) –

  • style (wx.TextAttr) –

Return type

bool



SetStyle (self, start, end, style)

Sets the attributes for the given range.

The end point of range is specified as the last character position of the span of text, plus one.

So, for example, to set the style for a character at position 5, use the range (5,6).

Parameters
Return type

bool



SetStyle (self, range, style)

Sets the attributes for the given range.

The end point of range is specified as the last character position of the span of text, plus one.

So, for example, to set the style for a character at position 5, use the range (5,6).

Parameters
Return type

bool



SetStyle (self, range, style)

Sets the attributes for the given range.

The end point of range is specified as the last character position of the span of text, plus one.

So, for example, to set the style for a character at position 5, use the range (5,6).

Parameters
Return type

bool



SetStyle (self, obj, textAttr, flags=RICHTEXT_SETSTYLE_WITH_UNDO)

Sets the attributes for a single object.

Parameters





SetStyleEx(self, range, style, flags=RICHTEXT_SETSTYLE_WITH_UNDO)

Sets the attributes for the given range, passing flags to determine how the attributes are set.

The end point of range is specified as the last character position of the span of text, plus one. So, for example, to set the style for a character at position 5, use the range (5,6).

flags may contain a bit list of the following values:

  • wx.richtext.RICHTEXT_SETSTYLE_NONE: no style flag.

  • wx.richtext.RICHTEXT_SETSTYLE_WITH_UNDO: specifies that this operation should be undoable.

  • wx.richtext.RICHTEXT_SETSTYLE_OPTIMIZE: specifies that the style should not be applied if the combined style at this point is already the style in question.

  • wx.richtext.RICHTEXT_SETSTYLE_PARAGRAPHS_ONLY: specifies that the style should only be applied to paragraphs, and not the content. This allows content styling to be preserved independently from that of e.g. a named paragraph style.

  • wx.richtext.RICHTEXT_SETSTYLE_CHARACTERS_ONLY: specifies that the style should only be applied to characters, and not the paragraph. This allows content styling to be preserved independently from that of e.g. a named paragraph style.

  • wx.richtext.RICHTEXT_SETSTYLE_RESET: resets (clears) the existing style before applying the new style.

  • wx.richtext.RICHTEXT_SETSTYLE_REMOVE: removes the specified style. Only the style flags are used in this operation.

Parameters
Return type

bool



SetStyleSheet(self, styleSheet)

Sets the style sheet associated with the control.

A style sheet allows named character and paragraph styles to be applied.

Parameters

styleSheet (wx.richtext.RichTextStyleSheet) –



SetTextCursor(self, cursor)

Sets the text (normal) cursor.

Parameters

cursor (wx.Cursor) –



SetURLCursor(self, cursor)

Sets the cursor to be used over URLs.

Parameters

cursor (wx.Cursor) –



SetValue(self, value)

Replaces existing content with the given text.

Parameters

value (string) –



SetupScrollbars(self, atTop=False)

A helper function setting up scrollbars, for example after a resize.

Parameters

atTop (bool) –



ShouldInheritColours(self)

Return True from here to allow the colours of this window to be changed by InheritAttributes .

Returning False forbids inheriting them from the parent window.

The base class version returns False, but this method is overridden in wx.Control where it returns True.

Return type

bool



ShowContextMenu(self, menu, pt, addPropertyCommands)

Shows the given context menu, optionally adding appropriate property-editing commands for the current position in the object hierarchy.

Parameters
Return type

bool



ShowPosition(self, pos)

Scrolls the buffer so that the given position is in view.

Parameters

pos (long) –



StartCellSelection(self, table, newCell)

Starts selecting table cells.

Parameters
Return type

bool



StoreFocusObject(self, obj)

Setter for m_focusObject.

Parameters

obj (wx.richtext.RichTextParagraphLayoutBox) –



SuppressingUndo(self)

Returns True if undo history suppression is on.

Return type

bool



Undo(self)

Undoes the command at the top of the command history, if there is one.



WordLeft(self, noPages=1, flags=0)

Moves a number of words to the left.

Parameters
  • noPages (int) –

  • flags (int) –

Return type

bool



WordRight(self, noPages=1, flags=0)

Move a number of words to the right.

Parameters
  • noPages (int) –

  • flags (int) –

Return type

bool



WriteField(self, fieldType, properties, textAttr=RichTextAttr())

Writes a field at the current insertion point.

Parameters
Return type

wx.richtext.RichTextField



WriteImage(self, *args, **kw)

overload Overloaded Implementations:



WriteImage (self, image, bitmapType=BITMAP_TYPE_PNG, textAttr=RichTextAttr())

Write a bitmap or image at the current insertion point.

Supply an optional type to use for internal and file storage of the raw data.

Parameters
Return type

bool



WriteImage (self, bitmap, bitmapType=BITMAP_TYPE_PNG, textAttr=RichTextAttr())

Write a bitmap or image at the current insertion point.

Supply an optional type to use for internal and file storage of the raw data.

Parameters
Return type

bool



WriteImage (self, filename, bitmapType, textAttr=RichTextAttr())

Loads an image from a file and writes it at the current insertion point.

Parameters
Return type

bool



WriteImage (self, imageBlock, textAttr=RichTextAttr())

Writes an image block at the current insertion point.

Parameters
Return type

bool





WriteTable(self, rows, cols, tableAttr=RichTextAttr(), cellAttr=RichTextAttr())

Write a table at the current insertion point, returning the table.

You can then call SetFocusObject to set the focus to the new object.

Parameters
Return type

wx.richtext.RichTextTable



WriteText(self, text)

Writes text at the current position.

Parameters

text (string) –



WriteTextBox(self, textAttr=RichTextAttr())

Write a text box at the current insertion point, returning the text box.

You can then call SetFocusObject to set the focus to the new object.

Parameters

textAttr (wx.richtext.RichTextAttr) –

Return type

wx.richtext.RichTextBox



XYToPosition(self, x, y)

Translates from column and line number to position.

Parameters
  • x (long) –

  • y (long) –

Return type

long


Properties

BasicStyle

See GetBasicStyle and SetBasicStyle



Buffer

See GetBuffer



CaretAtLineStart

See GetCaretAtLineStart and SetCaretAtLineStart



CaretPosition

See GetCaretPosition and SetCaretPosition



CaretPositionForDefaultStyle

See GetCaretPositionForDefaultStyle and SetCaretPositionForDefaultStyle



CommandProcessor

See GetCommandProcessor



ContextMenu

See GetContextMenu and SetContextMenu



ContextMenuPropertiesInfo

See GetContextMenuPropertiesInfo



DefaultStyle

See GetDefaultStyle and SetDefaultStyle



DefaultStyleEx

See GetDefaultStyleEx



DelayedImageLoading

See GetDelayedImageLoading



DelayedImageProcessingRequired

See GetDelayedImageProcessingRequired and SetDelayedImageProcessingRequired



DelayedImageProcessingTime

See GetDelayedImageProcessingTime and SetDelayedImageProcessingTime



DelayedLayoutThreshold

See GetDelayedLayoutThreshold and SetDelayedLayoutThreshold



DimensionScale

See GetDimensionScale and SetDimensionScale



DragStartPoint

See GetDragStartPoint and SetDragStartPoint



DragStartTime

See GetDragStartTime and SetDragStartTime



Dragging

See GetDragging and SetDragging



Filename

See GetFilename and SetFilename



FirstVisiblePoint

See GetFirstVisiblePoint



FirstVisiblePosition

See GetFirstVisiblePosition



FocusObject

See GetFocusObject and SetFocusObject



FontScale

See GetFontScale and SetFontScale



FullLayoutRequired

See GetFullLayoutRequired and SetFullLayoutRequired



FullLayoutSavedPosition

See GetFullLayoutSavedPosition and SetFullLayoutSavedPosition



FullLayoutTime

See GetFullLayoutTime and SetFullLayoutTime



HandlerFlags

See GetHandlerFlags and SetHandlerFlags



Hint

See GetHint and SetHint



ImagesEnabled

See GetImagesEnabled



InsertionPoint

See GetInsertionPoint and SetInsertionPoint



InternalSelectionRange

See GetInternalSelectionRange and SetInternalSelectionRange



LastPosition

See GetLastPosition



Margins

See GetMargins and SetMargins



NumberOfLines

See GetNumberOfLines



PreDrag

See GetPreDrag and SetPreDrag



Scale

See GetScale and SetScale



Selection

See GetSelection and SetSelection



SelectionAnchor

See GetSelectionAnchor and SetSelectionAnchor



SelectionAnchorObject

See GetSelectionAnchorObject and SetSelectionAnchorObject



SelectionRange

See GetSelectionRange and SetSelectionRange



StringSelection

See GetStringSelection



StyleSheet

See GetStyleSheet and SetStyleSheet



TextCursor

See GetTextCursor and SetTextCursor



URLCursor

See GetURLCursor and SetURLCursor



Value

See GetValue and SetValue



VerticalScrollbarEnabled

See GetVerticalScrollbarEnabled



VirtualAttributesEnabled

See GetVirtualAttributesEnabled