wx.richtext.RichTextCtrl

Inheritance diagram for wx.richtext.RichTextCtrl:



Description

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 wx.wxEVT_COMMAND_TEXT_ENTER and wx.wxEVT_COMMAND_TEXT_UPDATED, and wx.TextUrlEvent when URL content is clicked.


Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


Methods Summary

Class API

Methods

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

Constructor.

Parameters:


Returns:

wx.richtext.RichTextCtrl


AddImage(image)

Adds an image to the control’s buffer.

Parameters:


Returns:

wx.richtext.RichTextRange


AddParagraph(text)

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

Parameters:

  • text (string)

Returns:

wx.richtext.RichTextRange


AppendText(text)

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

Parameters:

  • text (string)

ApplyAlignmentToSelection(alignment)

Applies the given alignment to the selection (undoable).

For alignment values, see wx.richtext.RichTextAttr.

Parameters:

  • alignment (int)

Returns:

bool


ApplyBoldToSelection()

Apples bold to the selection (undoable).


Returns:

bool


ApplyItalicToSelection()

Applies italic to the selection (undoable).


Returns:

bool


ApplyStyle(def)

Applies the given style to the selection.

Parameters:

  • def (wx.richtext.RichTextStyleDefinition)

Returns:

bool


ApplyStyleSheet(sheet=None)

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:

  • sheet (wx.richtext.RichTextStyleSheet)

Returns:

bool


ApplyUnderlineToSelection()

Applies underline to the selection (undoable).


Returns:

bool


BatchingUndo()

Returns True if undo commands are being batched.


Returns:

bool


BeginAlignment(alignment)

Begins using alignment.

For alignment values, wx.richtext.RichTextAttr.

Parameters:

  • alignment (int)

Returns:

bool


BeginBatchUndo(cmdName)

Starts batching undo history for commands.

Parameters:

  • cmdName (string)

Returns:

bool


BeginBold()

Begins using bold.


Returns:

bool


BeginCharacterStyle(characterStyle)

Begins using the named character style.

Parameters:

  • characterStyle (string)

Returns:

bool


BeginFont(font)

Begins using this font.

Parameters:


Returns:

bool


BeginFontSize(pointSize)

Begins using the given point size.

Parameters:

  • pointSize (int)

Returns:

bool


BeginItalic()

Begins using italic.


Returns:

bool


BeginLeftIndent(leftIndent, leftSubIndent=0)

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

The sub-indent is an offset from the left 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 relative to the subsequent lines.

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:

  • leftIndent (int)
  • leftSubIndent (int)

Returns:

bool


BeginLineSpacing(lineSpacing)

Begins appling line spacing.

spacing is a multiple, where 10 means single-spacing, 15 means 1.5 spacing, and 20 means double spacing. The following constants are defined for convenience:

Line Spacing Flags Value
wx.richtext.TEXT_ATTR_LINE_SPACING_NORMAL 10
wx.richtext.TEXT_ATTR_LINE_SPACING_HALF 15
wx.richtext.TEXT_ATTR_LINE_SPACING_TWICE 20

Parameters:

  • lineSpacing (int)

Returns:

bool


BeginListStyle(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)

Returns:

bool


BeginNumberedBullet(bulletNumber, leftIndent, leftSubIndent, bulletStyle=wx.richtext.TEXT_ATTR_BULLET_STYLE_ARABIC | wx.richtext.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.

Parameters:

  • bulletNumber (int): Is a number, usually starting with 1.

  • leftIndent (int): Value in tenths of a millimetre.

  • leftSubIndent (int): Value in tenths of a millimetre.

  • bulletStyle (int): A bitlist of the following values:

    Bullet Style Flags

    Value

    wx.richtext.TEXT_ATTR_BULLET_STYLE_NONE

    0x00000000

    wx.richtext.TEXT_ATTR_BULLET_STYLE_ARABIC

    0x00000001

    wx.richtext.TEXT_ATTR_BULLET_STYLE_LETTERS_UPPER

    0x00000002

    wx.richtext.TEXT_ATTR_BULLET_STYLE_LETTERS_LOWER

    0x00000004

    wx.richtext.TEXT_ATTR_BULLET_STYLE_ROMAN_UPPER

    0x00000008

    wx.richtext.TEXT_ATTR_BULLET_STYLE_ROMAN_LOWER

    0x00000010

    wx.richtext.TEXT_ATTR_BULLET_STYLE_SYMBOL

    0x00000020

    wx.richtext.TEXT_ATTR_BULLET_STYLE_BITMAP

    0x00000040

    wx.richtext.TEXT_ATTR_BULLET_STYLE_PARENTHESES

    0x00000080

    wx.richtext.TEXT_ATTR_BULLET_STYLE_PERIOD

    0x00000100

    wx.richtext.TEXT_ATTR_BULLET_STYLE_STANDARD

    0x00000200

    wx.richtext.TEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS

    0x00000400

    wx.richtext.TEXT_ATTR_BULLET_STYLE_OUTLINE

    0x00000800

    wx.richtext.TEXT_ATTR_BULLET_STYLE_ALIGN_LEFT

    0x00000000

    wx.richtext.TEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT

    0x00001000

    wx.richtext.TEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE

    0x00002000

    Of these, wx.richtext.TEXT_ATTR_BULLET_STYLE_BITMAP is unimplemented.

wx.richtext.RichTextCtrl 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.


Returns:

bool


BeginParagraphSpacing(before, after)

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

Parameters:

  • before (int)
  • after (int)

Returns:

bool


BeginParagraphStyle(paragraphStyle)

Begins applying the named paragraph style.

Parameters:

  • paragraphStyle (string)

Returns:

bool


BeginRightIndent(rightIndent)

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

Parameters:

  • rightIndent (int)

Returns:

bool


BeginStandardBullet(bulletName, leftIndent, leftSubIndent, bulletStyle=wx.richtext.TEXT_ATTR_BULLET_STYLE_STANDARD)

Begins applying a standard bullet, using one of the standard bullet names (currently standard/circle or standard/square).

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

Parameters:

  • bulletName (string)
  • leftIndent (int)
  • leftSubIndent (int)
  • bulletStyle (int)

Returns:

bool


BeginStyle(style)

Begins applying a style.

Parameters:


Returns:

bool


BeginSuppressUndo()

Starts suppressing undo history for commands.


Returns:

bool


BeginSymbolBullet(symbol, leftIndent, leftSubIndent, bulletStyle=wx.richtext.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)

Returns:

bool


BeginTextColour(colour)

Begins using this colour.

Parameters:


Returns:

bool


BeginURL(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)

Returns:

bool


BeginUnderline()

Begins using underlining.


Returns:

bool


CanCopy()

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


Returns:

bool


CanCut()

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


Returns:

bool


CanDeleteSelection()

Returns True if selected content can be deleted.


Returns:

bool


CanPaste()

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


Returns:

bool


CanRedo()

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


Returns:

bool


CanUndo()

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


Returns:

bool


ChangeValue(value)

Parameters:

  • value (string)

Clear(range)

Clears the buffer content, leaving a single empty paragraph. Cannot be undone.

Parameters:


ClearListStyle(range, flags=wx.richtext.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:


Returns:

bool


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

Create(parent, id=wx.ID_ANY, value="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.richtext.RE_MULTILINE, validator=wx.DefaultValidator, name=wx.TextCtrlNameStr)

Creates the underlying window.

Parameters:


Returns:

bool


Cut()
Copies the selected content (if any) to the clipboard and deletes the selection. This is undoable.

Delete(range)

Deletes the content within the given range.

Parameters:


Returns:

bool


DeleteSelection()
Deletes the content in the selection, if any. This is undoable.

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

EmulateKeyPress(event)

Parameters:


Returns:

bool


EndAlignment()

Ends alignment.


Returns:

bool


EndAllStyles()

Ends application of all styles in the current style stack.


Returns:

bool


EndBatchUndo()

Ends batching undo command history.


Returns:

bool


EndBold()

Ends using bold.


Returns:

bool


EndCharacterStyle()

Ends application of a named character style.


Returns:

bool


EndFont()

Ends using a font.


Returns:

bool


EndFontSize()

Ends using a point size.


Returns:

bool


EndItalic()

Ends using italic.


Returns:

bool


EndLeftIndent()

Ends left indent.


Returns:

bool


EndLineSpacing()

Ends line spacing.


Returns:

bool


EndListStyle()

Ends using a specified list style.


Returns:

bool


EndNumberedBullet()

Ends application of a numbered bullet.


Returns:

bool


EndParagraphSpacing()

Ends paragraph spacing.


Returns:

bool


EndParagraphStyle()

Ends application of a named character style.


Returns:

bool


EndRightIndent()

Ends right indent.


Returns:

bool


EndStandardBullet()

End standard bullet.


Returns:

bool


EndStyle()

Ends the current style.


Returns:

bool


EndSuppressUndo()

Ends suppressing undo command history.


Returns:

bool


EndSymbolBullet()

Ends applying a symbol bullet.


Returns:

bool


EndTextColour()

Ends applying a text colour.


Returns:

bool


EndURL()

Ends applying a URL.


Returns:

bool


EndUnderline()

End applying underlining.


Returns:

bool


GetBasicStyle()

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


Returns:

wx.richtext.TextAttrEx


GetBuffer()

Returns the buffer associated with the control.


Returns:

wx.richtext.RichTextBuffer


GetDefaultStyle()

Retrieves a copy of the default style object.


Returns:

wx.richtext.TextAttrEx


GetDelayedLayoutThreshold()

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

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


Returns:

long


GetFilename()

Gets the current filename associated with the control.


Returns:

string


GetHandlerFlags()

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.


Returns:

int


GetInsertionPoint()

Returns the current insertion point.


Returns:

long


GetInternalSelectionRange()

Get the selection range in character positions. -1, -1 means no selection.

The range is in internal format, i.e. a single character selection is denoted by (n, n).


Returns:

wx.richtext.RichTextRange


GetLastPosition()

Returns the last position in the buffer.


Returns:

int


GetLineLength(lineNo)

Returns the length of the specified line in characters.

Parameters:

  • lineNo (long)

Returns:

int


GetLineText(lineNo)

Returns the text for the given line.

Parameters:

  • lineNo (long)

Returns:

string


GetNumberOfLines()

Returns the number of lines in the buffer.


Returns:

int


GetRange(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)

Returns:

string


GetSelection()

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.


Returns:

(from, to)


GetSelectionRange()

Returns the selection range in character positions. -1, -1 means no selection.


Returns:

wx.richtext.RichTextRange


GetStringSelection()

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


Returns:

string


GetStyle(position, style)

Gets the attributes at the given position.

The wx.richtext.RichTextAttr version is generally more efficient because it does not use wx.Font objects.

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.

Retrieve the style used at the given position. Copies the style values at position into the style parameter and returns True if successful. Returns False otherwise.

Parameters:


Returns:

bool


GetStyleForRange(range, style)

Gets the attributes common to the specified range.

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

Parameters:


Returns:

bool


GetStyleSheet()

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

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


Returns:

wx.richtext.RichTextStyleSheet


GetTextCursor()

Get text cursor.


Returns:

wx.Cursor


GetURLCursor()

Get URL cursor.


Returns:

wx.Cursor


GetUncombinedStyle(position, style)

Gets the attributes at the given position.

The wx.richtext.RichTextAttr version is generally more efficient because it does not use wx.Font objects.

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.

Parameters:


Returns:

bool


GetValue()

Returns the content of the entire control as a string.


Returns:

string


HasCharacterAttributes(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:


Returns:

bool


HasParagraphAttributes(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:


Returns:

bool


HasSelection()

Returns True if there is a selection.


Returns:

bool


IsEditable()

Returns True if the control is editable.


Returns:

bool


IsEmpty()
No docstrings available for this method.

IsModified()

Returns True if the buffer has been modified.


Returns:

bool


IsMultiLine()

Returns True if the control is multiline.


Returns:

bool


IsSelectionAligned(alignment)

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

Parameters:

  • alignment (int)

Returns:

bool


IsSelectionBold()

Returns True if all of the selection is bold.


Returns:

bool


IsSelectionItalics()

Returns True if all of the selection is italic.


Returns:

bool


IsSelectionUnderlined()

Returns True if all of the selection is underlined.


Returns:

bool


IsSingleLine()

Returns True if the control is single-line.

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


Returns:

bool


LayoutContent(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)

Returns:

bool


LineBreak()

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 string value wx.richtext.RichTextLineBreakChar to text content, or by typing Shift-Return.


Returns:

bool


LoadFile(file, type=wx.richtext.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)

Returns:

bool


MarkDirty()
Marks the buffer as modified.

MoveCaret(pos, showAtLineStart=False)

Move the caret to the given character position.

Parameters:

  • pos (long)
  • showAtLineStart (bool)

Returns:

bool


MoveDown(noLines=1, flags=0)

Moves the caret down.

Parameters:

  • noLines (int)
  • flags (int)

Returns:

bool


MoveEnd(flags=0)

Moves to the end of the buffer.

Parameters:

  • flags (int)

Returns:

bool


MoveHome(flags=0)

Moves to the start of the buffer.

Parameters:

  • flags (int)

Returns:

bool


MoveLeft(noPositions=1, flags=0)

Moves left.

Parameters:

  • noPositions (int)
  • flags (int)

Returns:

bool


MoveRight(noPositions=1, flags=0)

Moves right.

Parameters:

  • noPositions (int)
  • flags (int)

Returns:

bool


MoveToLineEnd(flags=0)

Moves to the end of the line.

Parameters:

  • flags (int)

Returns:

bool


MoveToLineStart(flags=0)

Moves to the start of the line.

Parameters:

  • flags (int)

Returns:

bool


MoveToParagraphEnd(flags=0)

Moves to the end of the paragraph.

Parameters:

  • flags (int)

Returns:

bool


MoveToParagraphStart(flags=0)

Moves to the start of the paragraph.

Parameters:

  • flags (int)

Returns:

bool


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

Moves up.

Parameters:

  • noLines (int)
  • flags (int)

Returns:

bool


Newline()

Inserts a new paragraph at the current insertion point. See also wx.richtext.RichTextCtrl.LineBreak.


Returns:

bool


NumberList(range, style, flags=wx.richtext.RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=-1, listLevel=-1)

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.

Parameters:


Returns:

bool


Paste()
Pastes content from the clipboard to the buffer.

PopStyleSheet()

Pop style sheet from top of stack


Returns:

wx.richtext.RichTextStyleSheet


PositionToXY(pos)

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

Parameters:

  • pos (int)

Returns:

(x, y)


PromoteList(promoteBy, range, style, flags=wx.richtext.RICHTEXT_SETSTYLE_WITH_UNDO, listLevel=-1)

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.

Parameters:


Returns:

bool


PushStyleSheet(styleSheet)

Push style sheet to top of stack.

Parameters:

  • styleSheet (wx.richtext.RichTextStyleSheet)

Returns:

bool


Redo()
Redoes the current command.

Remove(from)

Removes the content in the specified range.

Parameters:

  • from (long)

Replace(from, to, value)

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

Parameters:

  • from (long)
  • to (long)
  • value (string)

SaveFile(file="", type=wx.richtext.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)

Returns:

bool


SelectAll()
Selects all the text in the buffer.

SelectNone()
Cancels any selection.

SelectWord(position)

Select the word at the given character position.

Parameters:

  • position (long)

Returns:

bool


SetBasicStyle(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:


SetDefaultStyle(style)

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

Parameters:


Returns:

bool


SetDefaultStyleToCursorStyle()

Sets the default style to the style under the cursor.


Returns:

bool


SetDelayedLayoutThreshold(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)

SetEditable(editable)

Makes the control editable, or not.

Parameters:

  • editable (bool)

SetFilename(filename)

Sets the current filename.

Parameters:

  • filename (string)

SetHandlerFlags(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)

SetInsertionPoint(pos)

Sets the insertion point.

Parameters:

  • pos (int)

SetInsertionPointEnd()
Sets the insertion point to the end of the text control.

SetInternalSelectionRange(range)

Set the selection range in character positions. -1, -1 means no selection.

The range is in internal format, i.e. a single character selection is denoted by (n, n).

Parameters:


SetListStyle(range, style, flags=wx.richtext.RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=-1, listLevel=-1)

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.

Parameters:


Returns:

bool


SetMaxLength(len)

Set the max number of characters which may be entered in a single line text control.

Parameters:

  • len (int)

SetModified(modified)

Parameters:

  • modified (bool)

SetSelection(from, to)

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:

  • from (long)
  • to (long)

SetSelectionRange(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:


SetStyle(range, style)

Sets the attributes for the given range.

The wx.richtext.RichTextAttr version is generally more efficient because it does not use wx.Font objects.

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:


Returns:

bool


SetStyleEx(range, style, flags=wx.richtext.RICHTEXT_SETSTYLE_WITH_UNDO)

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

The wx.richtext.RichTextAttr version is generally more efficient because it does not use wx.Font objects.

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:


Returns:

bool


SetStyleSheet(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(cursor)

Set text cursor.

Parameters:


SetURLCursor(cursor)

Set URL cursor.

Parameters:


SetValue(value)

Replaces existing content with the given text.

Parameters:

  • value (string)

ShowPosition(pos)

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

Parameters:

  • pos (long)

SuppressingUndo()

Returns True if undo history suppression is on.


Returns:

bool


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

WordLeft(noWords=1, flags=0)

Moves a number of words to the left.

Parameters:

  • noWords (int)
  • flags (int)

Returns:

bool


WordRight(noWords=1, flags=0)

Move a nuber of words to the right.

Parameters:

  • noWords (int)
  • flags (int)

Returns:

bool


WriteBitmap(bitmap, bitmapType=wx.BITMAP_TYPE_PNG)

Write a bitmap at the current insertion point. Supply optional type to use for internal and file storage of the raw data.

Parameters:


Returns:

bool


WriteImage(image, bitmapType=wx.BITMAP_TYPE_PNG)

Write an image at the current insertion point. Supply an optional type to use for internal and file storage of the raw data.

Parameters:


Returns:

bool


WriteImageBlock(imageBlock)

Write an image block at the current insertion point.

Parameters:

  • imageBlock (wx.richtext.RichTextImageBlock)

Returns:

bool


WriteImageFile(filename, bitmapType=wx.BITMAP_TYPE_PNG)

Load an image from file and write at the current insertion point.

Parameters:

  • filename (string)
  • bitmapType (int)

Returns:

bool


WriteText(text)

Writes text at the current position.

Parameters:

  • text (string)

XYToPosition(x, y)

Translates from column and line number to position.

Parameters:

  • x (long)
  • y (long)

Returns:

long


Properties

Buffer
See GetBuffer
DefaultStyle
See GetDefaultStyle and SetDefaultStyle
DelayedLayoutThreshold
See GetDelayedLayoutThreshold and SetDelayedLayoutThreshold
Filename
See GetFilename and SetFilename
InsertionPoint
See GetInsertionPoint and SetInsertionPoint
InternalSelectionRange
See GetInternalSelectionRange and SetInternalSelectionRange
LastPosition
See GetLastPosition
NumberOfLines
See GetNumberOfLines
Selection
See GetSelection and SetSelection
SelectionRange
See GetSelectionRange and SetSelectionRange
StringSelection
See GetStringSelection
StyleSheet
See GetStyleSheet and SetStyleSheet
Value
See GetValue and SetValue