*********** wx.TextAttr *********** Inheritance diagram for `wx.TextAttr`: | .. inheritance-diagram:: wx.TextAttr | Description =========== `wx.TextAttr` represents the character and paragraph attributes, or style, for a range of text in a `wx.TextCtrl `_. When setting up a `wx.TextAttr` object, pass a bitlist mask to `SetFlags <#SetFlags>`_ to indicate which style elements should be changed. As a convenience, when you call a setter such as `SetFont <#SetFont>`_, the relevant bit will be set. **Constants** The following values can be passed to `SetAlignment <#SetAlignment>`_ to determine paragraph alignment: * ``wx.TEXT_ALIGNMENT_DEFAULT`` * ``wx.TEXT_ALIGNMENT_LEFT`` * ``wx.TEXT_ALIGNMENT_CENTRE`` * ``wx.TEXT_ALIGNMENT_CENTER`` = ``wxTEXT_ALIGNMENT_CENTRE`` * ``wx.TEXT_ALIGNMENT_RIGHT`` * ``wx.TEXT_ALIGNMENT_JUSTIFIED`` These values are passed in a bitlist to `SetFlags <#SetFlags>`_ to determine what attributes will be considered when setting the attributes for a text control: * ``wx.TEXT_ATTR_TEXT_COLOUR`` = 0x0001 * ``wx.TEXT_ATTR_BACKGROUND_COLOUR`` = 0x0002 * ``wx.TEXT_ATTR_FONT_FACE`` = 0x0004 * ``wx.TEXT_ATTR_FONT_SIZE`` = 0x0008 * ``wx.TEXT_ATTR_FONT_WEIGHT`` = 0x0010 * ``wx.TEXT_ATTR_FONT_ITALIC`` = 0x0020 * ``wx.TEXT_ATTR_FONT_UNDERLINE`` = 0x0040 * ``wx.TEXT_ATTR_FONT`` = ``wx.TEXT_ATTR_FONT_FACE`` | ``wx.TEXT_ATTR_FONT_SIZE`` | ``wx.TEXT_ATTR_FONT_WEIGHT`` | ``wx.TEXT_ATTR_FONT_ITALIC`` | ``wx.TEXT_ATTR_FONT_UNDERLINE`` * ``wx.TEXT_ATTR_ALIGNMENT`` = 0x0080 * ``wx.TEXT_ATTR_LEFT_INDENT`` = 0x0100 * ``wx.TEXT_ATTR_RIGHT_INDENT`` = 0x0200 * ``wx.TEXT_ATTR_TABS`` = 0x0400 Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `Combine <#Combine>`_ * `GetAlignment <#GetAlignment>`_ * `GetBackgroundColour <#GetBackgroundColour>`_ * `GetFlags <#GetFlags>`_ * `GetFont <#GetFont>`_ * `GetLeftIndent <#GetLeftIndent>`_ * `GetLeftSubIndent <#GetLeftSubIndent>`_ * `GetRightIndent <#GetRightIndent>`_ * `GetTabs <#GetTabs>`_ * `GetTextColour <#GetTextColour>`_ * `HasAlignment <#HasAlignment>`_ * `HasBackgroundColour <#HasBackgroundColour>`_ * `HasFlag <#HasFlag>`_ * `HasFont <#HasFont>`_ * `HasLeftIndent <#HasLeftIndent>`_ * `HasRightIndent <#HasRightIndent>`_ * `HasTabs <#HasTabs>`_ * `HasTextColour <#HasTextColour>`_ * `Init <#Init>`_ * `IsDefault <#IsDefault>`_ * `Merge <#Merge>`_ * `SetAlignment <#SetAlignment>`_ * `SetBackgroundColour <#SetBackgroundColour>`_ * `SetFlags <#SetFlags>`_ * `SetFont <#SetFont>`_ * `SetLeftIndent <#SetLeftIndent>`_ * `SetRightIndent <#SetRightIndent>`_ * `SetTabs <#SetTabs>`_ * `SetTextColour <#SetTextColour>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `Alignment <#Alignment>`_ * `BackgroundColour <#BackgroundColour>`_ * `Flags <#Flags>`_ * `Font <#Font>`_ * `LeftIndent <#LeftIndent>`_ * `LeftSubIndent <#LeftSubIndent>`_ * `RightIndent <#RightIndent>`_ * `Tabs <#Tabs>`_ * `TextColour <#TextColour>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(colText=wx.NullColour, colBack=wx.NullColour, font=wx.NullFont, alignment=wx.TEXT_ALIGNMENT_DEFAULT) The constructors initialize one or more of the text foreground colour, background colour, font, and alignment. The values not initialized in the constructor can be set later, otherwise `wx.TextCtrl.SetStyle `_ will use the default values for them. **Parameters:** * `colText` (`wx.Colour `_) * `colBack` (`wx.Colour `_) * `font` (`wx.Font `_) * `alignment` (int) | **Returns:** `wx.TextAttr `_ -------- .. method:: Combine(attr, attrDef, text) | **Parameters:** * `attr` (`wx.TextAttr `_) * `attrDef` (`wx.TextAttr `_) * `text` (`wx.TextCtrl `_) | **Returns:** `wx.TextAttr `_ -------- .. method:: GetAlignment() Returns the paragraph alignment. | **Returns:** `int` -------- .. method:: GetBackgroundColour() Return the background colour specified by this attribute. | **Returns:** `wx.Colour `_ -------- .. method:: GetFlags() Returns a bitlist indicating which attributes will be set. | **Returns:** `long` -------- .. method:: GetFont() Return the text font specified by this attribute. | **Returns:** `wx.Font `_ -------- .. method:: GetLeftIndent() Returns the left indent in tenths of a millimetre. | **Returns:** `int` -------- .. method:: GetLeftSubIndent() Returns the left sub indent for all lines but the first line in a paragraph in tenths of a millimetre. | **Returns:** `int` -------- .. method:: GetRightIndent() Returns the right indent in tenths of a millimetre. | **Returns:** `int` -------- .. method:: GetTabs() Returns the array of integers representing the tab stops. Each array element specifies the tab stop in tenths of a millimetre. | **Returns:** `list of integers` -------- .. method:: GetTextColour() Return the text colour specified by this attribute. | **Returns:** `wx.Colour `_ -------- .. method:: HasAlignment() Returns ``True`` if this style specifies the text alignment. | **Returns:** `bool` -------- .. method:: HasBackgroundColour() Returns ``True`` if this style specifies the background colour to use. | **Returns:** `bool` -------- .. method:: HasFlag(flag) | **Parameters:** * `flag` (long) | **Returns:** `bool` -------- .. method:: HasFont() Returns ``True`` if this style specifies the font to use. | **Returns:** `bool` -------- .. method:: HasLeftIndent() Returns ``True`` if this style specifies the left indent. | **Returns:** `bool` -------- .. method:: HasRightIndent() Returns ``True`` if this style specifies the right indent. | **Returns:** `bool` -------- .. method:: HasTabs() Returns ``True`` if this style specifies any tabstobs. | **Returns:** `bool` -------- .. method:: HasTextColour() Returns ``True`` if this style specifies the foreground colour to use. | **Returns:** `bool` -------- .. method:: Init() `No docstrings available for this method.` -------- .. method:: IsDefault() Returns ``True`` if this style specifies any non-default attributes. | **Returns:** `bool` -------- .. method:: 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:** * `base` (`wx.TextAttr `_) * `overlay` (`wx.TextAttr `_) | **Returns:** `wx.TextAttr `_ -------- .. method:: SetAlignment(alignment) Sets the paragraph alignment. **Parameters:** * `alignment` (int) -------- .. method:: SetBackgroundColour(colour) Sets the background colour. **Parameters:** * `colour` (`wx.Colour `_) -------- .. method:: SetFlags(flags) Pass a bitlist indicating which attributes will be set. **Parameters:** * `flags` (long) -------- .. method:: SetFont(font, font font) Sets the text font. **Parameters:** * `font` (`wx.Font `_) -------- .. method:: SetLeftIndent(indent, subIndent=0) Sets the left indent in tenths of a millimetre. `subIndent` sets the indent for all lines but the first line in a paragraph relative to the first line. **Parameters:** * `indent` (int) * `subIndent` (int) -------- .. method:: SetRightIndent(indent) Sets the right indent in tenths of a millimetre. **Parameters:** * `indent` (int) -------- .. method:: SetTabs(tabs) Sets the array of integers representing the tab stops. Each array element specifies the tab stop in tenths of a millimetre. **Parameters:** * `tabs` (list of integers) -------- .. method:: SetTextColour(colour) Sets the text colour. **Parameters:** * `colour` (`wx.Colour `_) -------- Properties ^^^^^^^^^^ .. attribute:: Alignment See `GetAlignment <#GetAlignment>`_ and `SetAlignment <#SetAlignment>`_ .. attribute:: BackgroundColour See `GetBackgroundColour <#GetBackgroundColour>`_ and `SetBackgroundColour <#SetBackgroundColour>`_ .. attribute:: Flags See `GetFlags <#GetFlags>`_ and `SetFlags <#SetFlags>`_ .. attribute:: Font See `GetFont <#GetFont>`_ and `SetFont <#SetFont>`_ .. attribute:: LeftIndent See `GetLeftIndent <#GetLeftIndent>`_ and `SetLeftIndent <#SetLeftIndent>`_ .. attribute:: LeftSubIndent See `GetLeftSubIndent <#GetLeftSubIndent>`_ .. attribute:: RightIndent See `GetRightIndent <#GetRightIndent>`_ and `SetRightIndent <#SetRightIndent>`_ .. attribute:: Tabs See `GetTabs <#GetTabs>`_ and `SetTabs <#SetTabs>`_ .. attribute:: TextColour See `GetTextColour <#GetTextColour>`_ and `SetTextColour <#SetTextColour>`_