Inheritance diagram for 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 wx.wxEVT_COMMAND_TEXT_ENTER and wx.wxEVT_COMMAND_TEXT_UPDATED, and wx.TextUrlEvent when URL content is clicked.
Constructor.
Parameters:
Returns:
Adds a new paragraph of text to the end of the buffer.
Parameters:
Returns:
Sets the insertion point to the end of the buffer and writes the text.
Parameters:
Applies the given alignment to the selection (undoable).
For alignment values, see wx.richtext.RichTextAttr.
Parameters:
Returns:
bool
Apples bold to the selection (undoable).
Returns:
bool
Applies italic to the selection (undoable).
Returns:
bool
Applies the given style to the selection.
Parameters:
Returns:
bool
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:
Returns:
bool
Applies underline to the selection (undoable).
Returns:
bool
Returns True if undo commands are being batched.
Returns:
bool
Begins using alignment.
For alignment values, wx.richtext.RichTextAttr.
Parameters:
Returns:
bool
Starts batching undo history for commands.
Parameters:
Returns:
bool
Begins using bold.
Returns:
bool
Begins using the named character style.
Parameters:
Returns:
bool
Begins using the given point size.
Parameters:
Returns:
bool
Begins using italic.
Returns:
bool
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:
Returns:
bool
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:
Returns:
bool
Begins using a specified list style. Optionally, you can also pass a level and a number.
Parameters:
Returns:
bool
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
Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of a millimetre.
Parameters:
Returns:
bool
Begins applying the named paragraph style.
Parameters:
Returns:
bool
Begins a right indent, specified in tenths of a millimetre.
Parameters:
Returns:
bool
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:
Returns:
bool
Begins applying a style.
Parameters:
Returns:
bool
Starts suppressing undo history for commands.
Returns:
bool
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:
Returns:
bool
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:
Returns:
bool
Begins using underlining.
Returns:
bool
Returns True if selected content can be copied to the clipboard.
Returns:
bool
Returns True if selected content can be copied to the clipboard and deleted.
Returns:
bool
Returns True if selected content can be deleted.
Returns:
bool
Returns True if the clipboard content can be pasted to the buffer.
Returns:
bool
Returns True if there is a command in the command history that can be redone.
Returns:
bool
Returns True if there is a command in the command history that can be undone.
Returns:
bool
Parameters:
Clears the buffer content, leaving a single empty paragraph. Cannot be undone.
Parameters:
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:
Parameters:
Returns:
bool
See also
Creates the underlying window.
Parameters:
Returns:
bool
Deletes the content within the given range.
Parameters:
Returns:
bool
Parameters:
Returns:
bool
Ends alignment.
Returns:
bool
Ends application of all styles in the current style stack.
Returns:
bool
Ends batching undo command history.
Returns:
bool
Ends using bold.
Returns:
bool
Ends application of a named character style.
Returns:
bool
Ends using a font.
Returns:
bool
Ends using a point size.
Returns:
bool
Ends using italic.
Returns:
bool
Ends left indent.
Returns:
bool
Ends line spacing.
Returns:
bool
Ends using a specified list style.
Returns:
bool
Ends application of a numbered bullet.
Returns:
bool
Ends paragraph spacing.
Returns:
bool
Ends application of a named character style.
Returns:
bool
Ends right indent.
Returns:
bool
End standard bullet.
Returns:
bool
Ends the current style.
Returns:
bool
Ends suppressing undo command history.
Returns:
bool
Ends applying a symbol bullet.
Returns:
bool
Ends applying a text colour.
Returns:
bool
Ends applying a URL.
Returns:
bool
End applying underlining.
Returns:
bool
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:
Returns the buffer associated with the control.
Returns:
Retrieves a copy of the default style object.
Returns:
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
Gets the current filename associated with the control.
Returns:
string
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
Returns the current insertion point.
Returns:
long
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:
Returns the last position in the buffer.
Returns:
int
Returns the length of the specified line in characters.
Parameters:
Returns:
int
Returns the text for the given line.
Parameters:
Returns:
string
Returns the number of lines in the buffer.
Returns:
int
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:
Returns:
string
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)
Returns the selection range in character positions. -1, -1 means no selection.
Returns:
Returns the text within the current selection range, if any.
Returns:
string
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
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
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
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
Returns the content of the entire control as a string.
Returns:
string
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
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
Returns True if there is a selection.
Returns:
bool
Returns True if the control is editable.
Returns:
bool
Returns True if the buffer has been modified.
Returns:
bool
Returns True if the control is multiline.
Returns:
bool
Returns True if all of the selection is aligned according to the specified flag.
Parameters:
Returns:
bool
Returns True if all of the selection is bold.
Returns:
bool
Returns True if all of the selection is italic.
Returns:
bool
Returns True if all of the selection is underlined.
Returns:
bool
Returns True if the control is single-line.
Currently wx.richtext.RichTextCtrl does not support single-line editing.
Returns:
bool
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:
Returns:
bool
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
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:
Returns:
bool
Move the caret to the given character position.
Parameters:
Returns:
bool
Moves the caret down.
Parameters:
Returns:
bool
Moves to the end of the buffer.
Parameters:
Returns:
bool
Moves to the start of the buffer.
Parameters:
Returns:
bool
Moves left.
Parameters:
Returns:
bool
Moves right.
Parameters:
Returns:
bool
Moves to the end of the line.
Parameters:
Returns:
bool
Moves to the start of the line.
Parameters:
Returns:
bool
Moves to the end of the paragraph.
Parameters:
Returns:
bool
Moves to the start of the paragraph.
Parameters:
Returns:
bool
Moves up.
Parameters:
Returns:
bool
Inserts a new paragraph at the current insertion point. See also wx.richtext.RichTextCtrl.LineBreak.
Returns:
bool
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:
Parameters:
Returns:
bool
See also
Pop style sheet from top of stack
Returns:
wx.richtext.RichTextStyleSheet
Converts a text position to zero-based column and line numbers.
Parameters:
Returns:
(x, y)
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:
Parameters:
Returns:
bool
See also
Push style sheet to top of stack.
Parameters:
Returns:
bool
Removes the content in the specified range.
Parameters:
Replaces the content in the specified range with the string specified by value.
Parameters:
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:
Returns:
bool
Select the word at the given character position.
Parameters:
Returns:
bool
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:
Sets the current default style, which can be used to change how subsequently inserted text is displayed.
Parameters:
Returns:
bool
Sets the default style to the style under the cursor.
Returns:
bool
Sets the size of the buffer beyond which layout is delayed during resizing.
This optimizes sizing for large buffers. The default is 20000.
Parameters:
Makes the control editable, or not.
Parameters:
Sets the current filename.
Parameters:
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:
Sets the insertion point.
Parameters:
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:
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:
Parameters:
Returns:
bool
See also
Set the max number of characters which may be entered in a single line text control.
Parameters:
Parameters:
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:
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:
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
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:
Parameters:
Returns:
bool
Sets the style sheet associated with the control.
A style sheet allows named character and paragraph styles to be applied.
Parameters:
Replaces existing content with the given text.
Parameters:
Scrolls the buffer so that the given position is in view.
Parameters:
Returns True if undo history suppression is on.
Returns:
bool
Moves a number of words to the left.
Parameters:
Returns:
bool
Move a nuber of words to the right.
Parameters:
Returns:
bool
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
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
Write an image block at the current insertion point.
Parameters:
Returns:
bool
Load an image from file and write at the current insertion point.
Parameters:
Returns:
bool
Writes text at the current position.
Parameters:
Translates from column and line number to position.
Parameters:
Returns:
long