phoenix_title wx.TextAttr

wx.TextAttr represents the character and paragraph attributes, or style, for a range of text in a wx.TextCtrl or wx.richtext.RichTextCtrl.

Unless explicitly mentioned, the attributes are only implemented in wx.richtext.RichTextCtrl, and not wx.TextCtrl.

When setting up a wx.TextAttr object, pass a bitlist mask to wx.TextAttr.SetFlags to indicate which style elements should be changed. As a convenience, when you call a setter such as SetFont, the relevant bit will be set.

See also

wx.TextCtrl, wx.richtext.RichTextCtrl


class_hierarchy Class Hierarchy

Inheritance diagram for class TextAttr:

sub_classes Known Subclasses

wx.richtext.RichTextAttr


method_summary Methods Summary

__init__

Constructors.

Apply

Applies the attributes in style to the original object, but not those attributes from style that are the same as those in compareWith (if passed).

EqPartial

Partial equality test.

GetAlignment

Returns the alignment flags.

GetBackgroundColour

Returns the background colour.

GetBulletFont

Returns a string containing the name of the font associated with the bullet symbol.

GetBulletName

Returns the standard bullet name, applicable if the bullet style is wx.TEXT_ATTR_BULLET_STYLE_STANDARD.

GetBulletNumber

Returns the bullet number.

GetBulletStyle

Returns the bullet style.

GetBulletText

Returns the bullet text, which could be a symbol, or (for example) cached outline text.

GetCharacterStyleName

Returns the name of the character style.

GetFlags

Returns flags indicating which attributes are applicable.

GetFont

Creates and returns a font specified by the font attributes in the wx.TextAttr object.

GetFontAttributes

Gets the font attributes from the given font, using only the attributes specified by flags.

GetFontEncoding

Returns the font encoding.

GetFontFaceName

Returns the font face name.

GetFontFamily

Returns the font family.

GetFontSize

Returns the font size in points.

GetFontStyle

Returns the font style.

GetFontUnderlined

Returns True if the font is underlined.

GetFontWeight

Returns the font weight.

GetLeftIndent

Returns the left indent in tenths of a millimetre.

GetLeftSubIndent

Returns the left sub-indent in tenths of a millimetre.

GetLineSpacing

Returns the line spacing value, one of wx.TextAttrLineSpacing values.

GetListStyleName

Returns the name of the list style.

GetOutlineLevel

Returns the outline level.

GetParagraphSpacingAfter

Returns the space in tenths of a millimeter after the paragraph.

GetParagraphSpacingBefore

Returns the space in tenths of a millimeter before the paragraph.

GetParagraphStyleName

Returns the name of the paragraph style.

GetRightIndent

Returns the right indent in tenths of a millimeter.

GetTabs

Returns an array of tab stops, each expressed in tenths of a millimeter.

GetTextColour

Returns the text foreground colour.

GetTextEffectFlags

Returns the text effect bits of interest.

GetTextEffects

Returns the text effects, a bit list of styles.

GetURL

Returns the URL for the content.

GetUnderlineColour

Returns the underline color used.

GetUnderlineType

Returns the underline type, which is one of the TextAttrUnderlineType values.

HasAlignment

Returns True if the attribute object specifies alignment.

HasBackgroundColour

Returns True if the attribute object specifies a background colour.

HasBulletName

Returns True if the attribute object specifies a standard bullet name.

HasBulletNumber

Returns True if the attribute object specifies a bullet number.

HasBulletStyle

Returns True if the attribute object specifies a bullet style.

HasBulletText

Returns True if the attribute object specifies bullet text (usually specifying a symbol).

HasCharacterStyleName

Returns True if the attribute object specifies a character style name.

HasFlag

Returns True if the flag is present in the attribute object’s flag bitlist.

HasFont

Returns True if the attribute object specifies any font attributes.

HasFontEncoding

Returns True if the attribute object specifies an encoding.

HasFontFaceName

Returns True if the attribute object specifies a font face name.

HasFontFamily

Returns True if the attribute object specifies a font family.

HasFontItalic

Returns True if the attribute object specifies italic style.

HasFontPixelSize

Returns True if the attribute object specifies a font pixel size.

HasFontPointSize

Returns True if the attribute object specifies a font point size.

HasFontSize

Returns True if the attribute object specifies a font point or pixel size.

HasFontUnderlined

Returns True if the attribute object specifies either underlining or no underlining.

HasFontWeight

Returns True if the attribute object specifies font weight (bold, light or normal).

HasLeftIndent

Returns True if the attribute object specifies a left indent.

HasLineSpacing

Returns True if the attribute object specifies line spacing.

HasListStyleName

Returns True if the attribute object specifies a list style name.

HasOutlineLevel

Returns True if the attribute object specifies an outline level.

HasPageBreak

Returns True if the attribute object specifies a page break before this paragraph.

HasParagraphSpacingAfter

Returns True if the attribute object specifies spacing after a paragraph.

HasParagraphSpacingBefore

Returns True if the attribute object specifies spacing before a paragraph.

HasParagraphStyleName

Returns True if the attribute object specifies a paragraph style name.

HasRightIndent

Returns True if the attribute object specifies a right indent.

HasTabs

Returns True if the attribute object specifies tab stops.

HasTextColour

Returns True if the attribute object specifies a text foreground colour.

HasTextEffects

Returns True if the attribute object specifies text effects.

HasURL

Returns True if the attribute object specifies a URL.

IsCharacterStyle

Returns True if the object represents a character style, that is, the flags specify a font or a text background or foreground colour.

IsDefault

Returns False if we have any attributes set, True otherwise.

IsParagraphStyle

Returns True if the object represents a paragraph style, that is, the flags specify alignment, indentation, tabs, paragraph spacing, or bullet style.

Merge

Copies all defined/valid properties from overlay to current object.

SetAlignment

Sets the paragraph alignment.

SetBackgroundColour

Sets the background colour.

SetBulletFont

Sets the name of the font associated with the bullet symbol.

SetBulletName

Sets the standard bullet name, applicable if the bullet style is wx.TEXT_ATTR_BULLET_STYLE_STANDARD.

SetBulletNumber

Sets the bullet number.

SetBulletStyle

Sets the bullet style.

SetBulletText

Sets the bullet text, which could be a symbol, or (for example) cached outline text.

SetCharacterStyleName

Sets the character style name.

SetFlags

Sets the flags determining which styles are being specified.

SetFont

Sets the attributes for the given font.

SetFontEncoding

Sets the font encoding.

SetFontFaceName

Sets the font face name.

SetFontFamily

Sets the font family.

SetFontPixelSize

Sets the font size in pixels.

SetFontPointSize

Sets the font size in points.

SetFontSize

Sets the font size in points.

SetFontStyle

Sets the font style (normal, italic or slanted).

SetFontUnderlined

Sets the font underlining (solid line, text colour).

SetFontUnderlineType

Sets the font underlining.

SetFontWeight

Sets the font weight.

SetLeftIndent

Sets the left indent and left subindent in tenths of a millimetre.

SetLineSpacing

Sets the line spacing.

SetListStyleName

Sets the list style name.

SetOutlineLevel

Specifies the outline level.

SetPageBreak

Specifies a page break before this paragraph.

SetParagraphSpacingAfter

Sets the spacing after a paragraph, in tenths of a millimetre.

SetParagraphSpacingBefore

Sets the spacing before a paragraph, in tenths of a millimetre.

SetParagraphStyleName

Sets the name of the paragraph style.

SetRightIndent

Sets the right indent in tenths of a millimetre.

SetTabs

Sets the tab stops, expressed in tenths of a millimetre.

SetTextColour

Sets the text foreground colour.

SetTextEffectFlags

Sets the text effect bits of interest.

SetTextEffects

Sets the text effects, a bit list of styles.

SetURL

Sets the URL for the content.


property_summary Properties Summary

Alignment

See GetAlignment and SetAlignment

BackgroundColour

See GetBackgroundColour and SetBackgroundColour

BulletFont

See GetBulletFont and SetBulletFont

BulletName

See GetBulletName and SetBulletName

BulletNumber

See GetBulletNumber and SetBulletNumber

BulletStyle

See GetBulletStyle and SetBulletStyle

BulletText

See GetBulletText and SetBulletText

CharacterStyleName

See GetCharacterStyleName and SetCharacterStyleName

Flags

See GetFlags and SetFlags

Font

See GetFont and SetFont

FontEncoding

See GetFontEncoding and SetFontEncoding

FontFaceName

See GetFontFaceName and SetFontFaceName

FontFamily

See GetFontFamily and SetFontFamily

FontSize

See GetFontSize and SetFontSize

FontStyle

See GetFontStyle and SetFontStyle

FontUnderlined

See GetFontUnderlined and SetFontUnderlined

FontWeight

See GetFontWeight and SetFontWeight

LeftIndent

See GetLeftIndent and SetLeftIndent

LeftSubIndent

See GetLeftSubIndent

LineSpacing

See GetLineSpacing and SetLineSpacing

ListStyleName

See GetListStyleName and SetListStyleName

OutlineLevel

See GetOutlineLevel and SetOutlineLevel

ParagraphSpacingAfter

See GetParagraphSpacingAfter and SetParagraphSpacingAfter

ParagraphSpacingBefore

See GetParagraphSpacingBefore and SetParagraphSpacingBefore

ParagraphStyleName

See GetParagraphStyleName and SetParagraphStyleName

RightIndent

See GetRightIndent and SetRightIndent

Tabs

See GetTabs and SetTabs

TextColour

See GetTextColour and SetTextColour

TextEffectFlags

See GetTextEffectFlags and SetTextEffectFlags

TextEffects

See GetTextEffects and SetTextEffects

URL

See GetURL and SetURL

UnderlineColour

See GetUnderlineColour

UnderlineType

See GetUnderlineType


api Class API

class wx.TextAttr(object)

Possible constructors:

TextAttr()

TextAttr(colText, colBack=NullColour, font=NullFont,
         alignment=TEXT_ALIGNMENT_DEFAULT)

TextAttr(attr)

TextAttr represents the character and paragraph attributes, or style, for a range of text in a TextCtrl or RichTextCtrl.


Methods

__init__(self, *args, **kw)

Constructors.

overload Overloaded Implementations:



__init__ (self)



__init__ (self, colText, colBack=NullColour, font=NullFont, alignment=TEXT_ALIGNMENT_DEFAULT)

Parameters:



__init__ (self, attr)

Parameters:

attr (wx.TextAttr) –





Apply(self, style, compareWith=None)

Applies the attributes in style to the original object, but not those attributes from style that are the same as those in compareWith (if passed).

Parameters:
Return type:

bool



EqPartial(self, attr, weakTest=True)

Partial equality test.

If weakTest is True, attributes of this object do not have to be present if those attributes of attr are present. If weakTest is False, the function will fail if an attribute is present in attr but not in this object.

Parameters:
Return type:

bool



GetAlignment(self)

Returns the alignment flags.

See wx.TextAttrAlignment for a list of available styles.

For wx.TextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

wx.TextAttrAlignment



GetBackgroundColour(self)

Returns the background colour.

For wx.TextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

wx.Colour



GetBulletFont(self)

Returns a string containing the name of the font associated with the bullet symbol.

Only valid for attributes with TEXT_ATTR_BULLET_SYMBOL.

Return type:

string



GetBulletName(self)

Returns the standard bullet name, applicable if the bullet style is wx.TEXT_ATTR_BULLET_STYLE_STANDARD.

Currently the following standard bullet names are supported:

  • standard/circle

  • standard/square

  • standard/diamond

  • standard/triangle

Return type:

string

Note

For wx.richtext.RichTextCtrl users only: if you wish your rich text controls to support further bullet graphics, you can derive a class from wx.richtext.RichTextRenderer or wx.richtext.RichTextStdRenderer, override DrawStandardBullet and EnumerateStandardBulletNames , and set an instance of the class using wx.richtext.RichTextBuffer.SetRenderer .



GetBulletNumber(self)

Returns the bullet number.

For wx.TextCtrl, is implemented under wxMSW. Also implemented in wx.richtext.RichTextCtrl.

Return type:

int



GetBulletStyle(self)

Returns the bullet style.

See wx.TextAttrBulletStyle for a list of available styles.

For wx.TextCtrl, is implemented under wxMSW. Also implemented in wx.richtext.RichTextCtrl.

Return type:

int



GetBulletText(self)

Returns the bullet text, which could be a symbol, or (for example) cached outline text.

Return type:

string



GetCharacterStyleName(self)

Returns the name of the character style.

Return type:

string



GetFlags(self)

Returns flags indicating which attributes are applicable.

See SetFlags for a list of available flags.

Return type:

long



GetFont(self)

Creates and returns a font specified by the font attributes in the wx.TextAttr object.

Note that wx.TextAttr does not store a wx.Font object, so this is only a temporary font.

For greater efficiency, access the font attributes directly.

For wx.TextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

wx.Font



GetFontAttributes(self, font, flags=TEXT_ATTR_FONT)

Gets the font attributes from the given font, using only the attributes specified by flags.

Parameters:
  • font (wx.Font) –

  • flags (int) –

Return type:

bool



GetFontEncoding(self)

Returns the font encoding.

Return type:

wx.FontEncoding



GetFontFaceName(self)

Returns the font face name.

Return type:

string



GetFontFamily(self)

Returns the font family.

Return type:

wx.FontFamily



GetFontSize(self)

Returns the font size in points.

Return type:

int



GetFontStyle(self)

Returns the font style.

Return type:

wx.FontStyle



GetFontUnderlined(self)

Returns True if the font is underlined.

Return type:

bool



GetFontWeight(self)

Returns the font weight.

Return type:

wx.FontWeight



GetLeftIndent(self)

Returns the left indent in tenths of a millimetre.

For wx.TextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

long



GetLeftSubIndent(self)

Returns the left sub-indent in tenths of a millimetre.

For wx.TextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

long



GetLineSpacing(self)

Returns the line spacing value, one of wx.TextAttrLineSpacing values.

For wx.TextCtrl, is implemented under wxMSW. Also implemented in wx.richtext.RichTextCtrl.

Return type:

int



GetListStyleName(self)

Returns the name of the list style.

Return type:

string



GetOutlineLevel(self)

Returns the outline level.

Return type:

int



GetParagraphSpacingAfter(self)

Returns the space in tenths of a millimeter after the paragraph.

For wx.TextCtrl, is implemented under wxMSW. Also implemented in wx.richtext.RichTextCtrl.

Return type:

int



GetParagraphSpacingBefore(self)

Returns the space in tenths of a millimeter before the paragraph.

For wx.TextCtrl, is implemented under wxMSW. Also implemented in wx.richtext.RichTextCtrl.

Return type:

int



GetParagraphStyleName(self)

Returns the name of the paragraph style.

Return type:

string



GetRightIndent(self)

Returns the right indent in tenths of a millimeter.

For wx.TextCtrl, is implemented under wxMSW. Also implemented in wx.richtext.RichTextCtrl.

Return type:

long



GetTabs(self)

Returns an array of tab stops, each expressed in tenths of a millimeter.

Each stop is measured from the left margin and therefore each value must be larger than the last.

For wx.TextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

list of integers



GetTextColour(self)

Returns the text foreground colour.

For wx.TextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

wx.Colour



GetTextEffectFlags(self)

Returns the text effect bits of interest.

See SetFlags for further information.

Return type:

int



GetTextEffects(self)

Returns the text effects, a bit list of styles.

See SetTextEffects for details.

Return type:

int



GetURL(self)

Returns the URL for the content.

Content with wx.TEXT_ATTR_URL style causes wx.richtext.RichTextCtrl to show a hand cursor over it, and wx.richtext.RichTextCtrl generates a wx.TextUrlEvent when the content is clicked.

Return type:

string



GetUnderlineColour(self)

Returns the underline color used.

NullColour when the text colour is used.

For wx.TextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

wx.Colour

New in version 4.1/wxWidgets-3.1.3.



GetUnderlineType(self)

Returns the underline type, which is one of the TextAttrUnderlineType values.

For wx.TextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

wx.TextAttrUnderlineType

New in version 4.1/wxWidgets-3.1.3.



HasAlignment(self)

Returns True if the attribute object specifies alignment.

For wx.TextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

bool



HasBackgroundColour(self)

Returns True if the attribute object specifies a background colour.

For wx.TextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

bool



HasBulletName(self)

Returns True if the attribute object specifies a standard bullet name.

Return type:

bool



HasBulletNumber(self)

Returns True if the attribute object specifies a bullet number.

For wx.TextCtrl, is implemented under wxMSW. Also implemented in wx.richtext.RichTextCtrl.

Return type:

bool



HasBulletStyle(self)

Returns True if the attribute object specifies a bullet style.

For wx.TextCtrl, is implemented under wxMSW. Also implemented in wx.richtext.RichTextCtrl.

Return type:

bool



HasBulletText(self)

Returns True if the attribute object specifies bullet text (usually specifying a symbol).

Return type:

bool



HasCharacterStyleName(self)

Returns True if the attribute object specifies a character style name.

Return type:

bool



HasFlag(self, flag)

Returns True if the flag is present in the attribute object’s flag bitlist.

Parameters:

flag (long) –

Return type:

bool



HasFont(self)

Returns True if the attribute object specifies any font attributes.

For wx.TextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

bool



HasFontEncoding(self)

Returns True if the attribute object specifies an encoding.

Return type:

bool



HasFontFaceName(self)

Returns True if the attribute object specifies a font face name.

Return type:

bool



HasFontFamily(self)

Returns True if the attribute object specifies a font family.

Return type:

bool



HasFontItalic(self)

Returns True if the attribute object specifies italic style.

Return type:

bool



HasFontPixelSize(self)

Returns True if the attribute object specifies a font pixel size.

Return type:

bool



HasFontPointSize(self)

Returns True if the attribute object specifies a font point size.

Return type:

bool



HasFontSize(self)

Returns True if the attribute object specifies a font point or pixel size.

Return type:

bool



HasFontUnderlined(self)

Returns True if the attribute object specifies either underlining or no underlining.

Return type:

bool



HasFontWeight(self)

Returns True if the attribute object specifies font weight (bold, light or normal).

Return type:

bool



HasLeftIndent(self)

Returns True if the attribute object specifies a left indent.

For wx.TextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

bool



HasLineSpacing(self)

Returns True if the attribute object specifies line spacing.

For wx.TextCtrl, is implemented under wxMSW and wxOSX. Also implemented in wx.richtext.RichTextCtrl.

Return type:

bool



HasListStyleName(self)

Returns True if the attribute object specifies a list style name.

Return type:

bool



HasOutlineLevel(self)

Returns True if the attribute object specifies an outline level.

Return type:

bool



HasPageBreak(self)

Returns True if the attribute object specifies a page break before this paragraph.

Return type:

bool



HasParagraphSpacingAfter(self)

Returns True if the attribute object specifies spacing after a paragraph.

For wx.TextCtrl, is implemented under wxMSW. Also implemented in wx.richtext.RichTextCtrl.

Return type:

bool



HasParagraphSpacingBefore(self)

Returns True if the attribute object specifies spacing before a paragraph.

For wx.TextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

bool



HasParagraphStyleName(self)

Returns True if the attribute object specifies a paragraph style name.

Return type:

bool



HasRightIndent(self)

Returns True if the attribute object specifies a right indent.

Return type:

bool



HasTabs(self)

Returns True if the attribute object specifies tab stops.

For wx.TextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

bool



HasTextColour(self)

Returns True if the attribute object specifies a text foreground colour.

For wx.TextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Return type:

bool



HasTextEffects(self)

Returns True if the attribute object specifies text effects.

Return type:

bool



HasURL(self)

Returns True if the attribute object specifies a URL.

Return type:

bool



IsCharacterStyle(self)

Returns True if the object represents a character style, that is, the flags specify a font or a text background or foreground colour.

Return type:

bool



IsDefault(self)

Returns False if we have any attributes set, True otherwise.

Return type:

bool



IsParagraphStyle(self)

Returns True if the object represents a paragraph style, that is, the flags specify alignment, indentation, tabs, paragraph spacing, or bullet style.

Return type:

bool



Merge(self, *args, **kw)

overload Overloaded Implementations:



Merge (self, overlay)

Copies all defined/valid properties from overlay to current object.

Parameters:

overlay (wx.TextAttr) –



Merge (base, overlay)

Creates a new wx.TextAttr which is a merge of base and overlay.

Properties defined in overlay take precedence over those in base. Properties undefined/invalid in both are undefined in the result.

Parameters:
Return type:

wx.TextAttr





SetAlignment(self, alignment)

Sets the paragraph alignment.

See wx.TextAttrAlignment enumeration values.

wx.TEXT_ALIGNMENT_JUSTIFIED is not implemented for wx.richtext.RichTextCtrl. In the future, wx.richtext.RichTextCtrl justification may be supported when printing or previewing only.

For wx.TextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Parameters:

alignment (TextAttrAlignment) –



SetBackgroundColour(self, colBack)

Sets the background colour.

For wx.TextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Parameters:

colBack (wx.Colour) –



SetBulletFont(self, font)

Sets the name of the font associated with the bullet symbol.

Only valid for attributes with TEXT_ATTR_BULLET_SYMBOL.

Parameters:

font (string) –



SetBulletName(self, name)

Sets the standard bullet name, applicable if the bullet style is wx.TEXT_ATTR_BULLET_STYLE_STANDARD.

See GetBulletName for a list of supported names, and how to expand the range of supported types.

Parameters:

name (string) –



SetBulletNumber(self, n)

Sets the bullet number.

For wx.TextCtrl, is implemented under wxMSW. Also implemented in wx.richtext.RichTextCtrl.

Parameters:

n (int) –



SetBulletStyle(self, style)

Sets the bullet style.

For wx.TextCtrl, is implemented under wxMSW. Also implemented in wx.richtext.RichTextCtrl.

For wx.richtext.RichTextCtrl, the wx.TextAttrBulletStyle enumeration values are all supported, except for wx.TEXT_ATTR_BULLET_STYLE_BITMAP.

For wx.TextCtrl under wxMSW, the wx.TextAttrBulletStyle enumeration values are all supported, except for wx.TEXT_ATTR_BULLET_STYLE_BITMAP, wx.TEXT_ATTR_BULLET_STYLE_OUTLINE, wx.TEXT_ATTR_BULLET_STYLE_ALIGN_LEFT, wx.TEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT, wx.TEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE, and wx.TEXT_ATTR_BULLET_STYLE_CONTINUATION.

Parameters:

style (int) –



SetBulletText(self, text)

Sets the bullet text, which could be a symbol, or (for example) cached outline text.

Parameters:

text (string) –



SetCharacterStyleName(self, name)

Sets the character style name.

Parameters:

name (string) –



SetFlags(self, flags)

Sets the flags determining which styles are being specified.

The wx.TextAttrFlags values can be passed in a bitlist.

Parameters:

flags (long) –



SetFont(self, font, flags=TEXT_ATTR_FONT & ~TEXT_ATTR_FONT_PIXEL_SIZE)

Sets the attributes for the given font.

Note that wx.TextAttr does not store an actual wx.Font object.

For wx.TextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Parameters:
  • font (wx.Font) –

  • flags (int) –



SetFontEncoding(self, encoding)

Sets the font encoding.

Parameters:

encoding (FontEncoding) –



SetFontFaceName(self, faceName)

Sets the font face name.

Parameters:

faceName (string) –



SetFontFamily(self, family)

Sets the font family.

Parameters:

family (FontFamily) –



SetFontPixelSize(self, pixelSize)

Sets the font size in pixels.

Parameters:

pixelSize (int) –



SetFontPointSize(self, pointSize)

Sets the font size in points.

Parameters:

pointSize (int) –



SetFontSize(self, pointSize)

Sets the font size in points.

Parameters:

pointSize (int) –



SetFontStyle(self, fontStyle)

Sets the font style (normal, italic or slanted).

Parameters:

fontStyle (FontStyle) –



SetFontUnderlined(self, underlined)

Sets the font underlining (solid line, text colour).

Parameters:

underlined (bool) –



SetFontUnderlineType(self, type, colour=NullColour)

Sets the font underlining.

Parameters:

New in version 4.1/wxWidgets-3.1.3.

Note

On wxMSW, wx.TEXT_ATTR_UNDERLINE_DOUBLE is shown as wx.TEXT_ATTR_UNDERLINE_SOLID. There is only a limited number of colours supported, the RGB values are listed here. wx.TEXT_ATTR_UNDERLINE_SPECIAL is shown as a waved line.

Note

On wxGTK, underline colour is only supported by GTK3. wx.TEXT_ATTR_UNDERLINE_SPECIAL is shown as a waved line. GTK might overrule the colour of wx.TEXT_ATTR_UNDERLINE_SPECIAL.

Note

On wxOSX, wx.TEXT_ATTR_UNDERLINE_SPECIAL is shown as a dotted line.



SetFontWeight(self, fontWeight)

Sets the font weight.

Parameters:

fontWeight (FontWeight) –



SetLeftIndent(self, indent, subIndent=0)

Sets the left indent and left 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.

For wx.TextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Parameters:
  • indent (int) –

  • subIndent (int) –



SetLineSpacing(self, spacing)

Sets the line spacing.

spacing is a multiple, where 10 means single-spacing, 15 means 1.5 spacing, and 20 means float spacing. The wx.TextAttrLineSpacing values are defined for convenience.

For wx.TextCtrl, is implemented under wxMSW. Also implemented in wx.richtext.RichTextCtrl.

Parameters:

spacing (int) –



SetListStyleName(self, name)

Sets the list style name.

Parameters:

name (string) –



SetOutlineLevel(self, level)

Specifies the outline level.

Zero represents normal text. At present, the outline level is not used, but may be used in future for determining list levels and for applications that need to store document structure information.

Parameters:

level (int) –



SetPageBreak(self, pageBreak=True)

Specifies a page break before this paragraph.

Parameters:

pageBreak (bool) –



SetParagraphSpacingAfter(self, spacing)

Sets the spacing after a paragraph, in tenths of a millimetre.

For wx.TextCtrl, is implemented under wxMSW. Also implemented in wx.richtext.RichTextCtrl.

Parameters:

spacing (int) –



SetParagraphSpacingBefore(self, spacing)

Sets the spacing before a paragraph, in tenths of a millimetre.

For wx.TextCtrl, is implemented under wxMSW. Also implemented in wx.richtext.RichTextCtrl.

Parameters:

spacing (int) –



SetParagraphStyleName(self, name)

Sets the name of the paragraph style.

Parameters:

name (string) –



SetRightIndent(self, indent)

Sets the right indent in tenths of a millimetre.

Parameters:

indent (int) –



SetTabs(self, tabs)

Sets the tab stops, expressed in tenths of a millimetre.

Each stop is measured from the left margin and therefore each value must be larger than the last.

For wx.TextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wx.richtext.RichTextCtrl.

Parameters:

tabs (list of integers) –



SetTextColour(self, colText)

Sets the text foreground colour.

Parameters:

colText (wx.Colour) –



SetTextEffectFlags(self, flags)

Sets the text effect bits of interest.

You should also pass wx.TEXT_ATTR_EFFECTS to SetFlags . See SetFlags for further information.

Parameters:

flags (int) –



SetTextEffects(self, effects)

Sets the text effects, a bit list of styles.

The wx.TextAttrEffects enumeration values can be used.

Of these, only wx.TEXT_ATTR_EFFECT_CAPITALS, wx.TEXT_ATTR_EFFECT_STRIKETHROUGH, wx.TEXT_ATTR_EFFECT_SUPERSCRIPT and wx.TEXT_ATTR_EFFECT_SUBSCRIPT are implemented.

wx.TEXT_ATTR_EFFECT_CAPITALS capitalises text when displayed (leaving the case of the actual buffer text unchanged), and wx.TEXT_ATTR_EFFECT_STRIKETHROUGH draws a line through text.

To set effects, you should also pass wx.TEXT_ATTR_EFFECTS to SetFlags , and call SetTextEffectFlags with the styles (taken from the above set) that you are interested in setting.

Parameters:

effects (int) –



SetURL(self, url)

Sets the URL for the content.

Sets the wx.TEXT_ATTR_URL style; content with this style causes wx.richtext.RichTextCtrl to show a hand cursor over it, and wx.richtext.RichTextCtrl generates a wx.TextUrlEvent when the content is clicked.

Parameters:

url (string) –


Properties

Alignment

See GetAlignment and SetAlignment



BackgroundColour

See GetBackgroundColour and SetBackgroundColour



BulletFont

See GetBulletFont and SetBulletFont



BulletName

See GetBulletName and SetBulletName



BulletNumber

See GetBulletNumber and SetBulletNumber



BulletStyle

See GetBulletStyle and SetBulletStyle



BulletText

See GetBulletText and SetBulletText



CharacterStyleName

See GetCharacterStyleName and SetCharacterStyleName



Flags

See GetFlags and SetFlags



Font

See GetFont and SetFont



FontEncoding

See GetFontEncoding and SetFontEncoding



FontFaceName

See GetFontFaceName and SetFontFaceName



FontFamily

See GetFontFamily and SetFontFamily



FontSize

See GetFontSize and SetFontSize



FontStyle

See GetFontStyle and SetFontStyle



FontUnderlined

See GetFontUnderlined and SetFontUnderlined



FontWeight

See GetFontWeight and SetFontWeight



LeftIndent

See GetLeftIndent and SetLeftIndent



LeftSubIndent

See GetLeftSubIndent



LineSpacing

See GetLineSpacing and SetLineSpacing



ListStyleName

See GetListStyleName and SetListStyleName



OutlineLevel

See GetOutlineLevel and SetOutlineLevel



ParagraphSpacingAfter

See GetParagraphSpacingAfter and SetParagraphSpacingAfter



ParagraphSpacingBefore

See GetParagraphSpacingBefore and SetParagraphSpacingBefore



ParagraphStyleName

See GetParagraphStyleName and SetParagraphStyleName



RightIndent

See GetRightIndent and SetRightIndent



Tabs

See GetTabs and SetTabs



TextColour

See GetTextColour and SetTextColour



TextEffectFlags

See GetTextEffectFlags and SetTextEffectFlags



TextEffects

See GetTextEffects and SetTextEffects



URL

See GetURL and SetURL



UnderlineColour

See GetUnderlineColour



UnderlineType

See GetUnderlineType