 wx.grid.GridCellAttr¶
 wx.grid.GridCellAttr¶This class can be used to alter the cells’ appearance in the grid by changing their attributes from the defaults.
An object of this class may be returned by wx.grid.GridTableBase.GetAttr .
 Methods Summary¶
 Methods Summary¶| Default constructor. | |
| Creates a new copy of this object. | |
| This class is reference counted: it is created with ref count of 1, so calling  | |
| Get the alignment to use for the cell with the given attribute. | |
| Returns the background colour. | |
| Returns the cell editor. | |
| Returns the font. | |
| Get the alignment defined by this attribute. | |
| Returns the cell renderer. | |
| Returns the text colour. | |
| Returns  | |
| Returns  | |
| Returns  | |
| Returns  | |
| Returns  | |
| Returns  | |
| This class is reference counted: it is created with ref count of 1, so calling  | |
| Returns  | |
| Sets the alignment. | |
| Sets the background colour. | |
| Sets the editor to be used with the cells with this attribute. | |
| Sets the font. | |
| Sets the cell as read-only. | |
| Sets the renderer to be used for cells with this attribute. | |
| Sets the text colour. | |
| 
 | The destructor is private because only  | 
 Class API¶
 Class API¶wx.grid.GridCellAttr(ClientDataContainer, RefCounter)¶Possible constructors:
GridCellAttr(attrDefault=None)
GridCellAttr(colText, colBack, font, hAlign, vAlign)
This class can be used to alter the cells’ appearance in the grid by changing their attributes from the defaults.
__init__(self, *args, **kw)¶__init__ (self, attrDefault=None)
Default constructor.
attrDefault (wx.grid.GridCellAttr) –
__init__ (self, colText, colBack, font, hAlign, vAlign)
Constructor specifying some of the often used attributes.
Clone(self)¶Creates a new copy of this object.
DecRef(self)¶This class is reference counted: it is created with ref count of 1, so calling DecRef   once will delete it.
Calling IncRef   allows locking it until the matching DecRef   is called.
GetAlignment(self)¶Get the alignment to use for the cell with the given attribute.
If this attribute doesn’t specify any alignment, the default attribute alignment is used (which can be changed using wx.grid.Grid.SetDefaultCellAlignment   but is left and top by default).
Notice that hAlign  and vAlign  values are always overwritten by this function, use GetNonDefaultAlignment   if this is not desirable.
tuple
( hAlign, vAlign )
GetBackgroundColour(self)¶Returns the background colour.
Colour
GetEditor(self, grid, row, col)¶Returns the cell editor.
grid (wx.grid.Grid) –
row (int) –
col (int) –
GetKind(self)¶GetNonDefaultAlignment(self)¶Get the alignment defined by this attribute.
Unlike GetAlignment   this function only modifies hAlign  and vAlign  if this attribute does define a non-default alignment. This means that they must be initialized before calling this function and that their values will be preserved unchanged if they are different from wx.ALIGN_INVALID.
For example, the following fragment can be used to use the cell alignment if one is defined but right-align its contents by default (instead of left-aligning it by default) while still using the default vertical alignment:
hAlign = wx.ALIGN_RIGHT
vAlign = wx.ALIGN_INVALID
hAlign, vAlign = attr.GetNonDefaultAlignment()
tuple
( hAlign, vAlign )
New in version 2.9.1.
GetOverflow(self)¶bool
GetRenderer(self, grid, row, col)¶Returns the cell renderer.
grid (wx.grid.Grid) –
row (int) –
col (int) –
GetSize(self)¶tuple
( num_rows, num_cols )
GetTextColour(self)¶Returns the text colour.
Colour
HasAlignment(self)¶Returns True if this attribute has a valid alignment set.
bool
HasBackgroundColour(self)¶Returns True if this attribute has a valid background colour set.
bool
HasEditor(self)¶Returns True if this attribute has a valid cell editor set.
bool
HasFont(self)¶Returns True if this attribute has a valid font set.
bool
HasOverflowMode(self)¶bool
HasReadWriteMode(self)¶bool
HasRenderer(self)¶Returns True if this attribute has a valid cell renderer set.
bool
HasSize(self)¶bool
HasTextColour(self)¶Returns True if this attribute has a valid text colour set.
bool
IncRef(self)¶This class is reference counted: it is created with ref count of 1, so calling DecRef   once will delete it.
Calling IncRef   allows locking it until the matching DecRef   is called.
IsReadOnly(self)¶Returns True if this cell is set as read-only.
bool
MergeWith(self, mergefrom)¶mergefrom (wx.grid.GridCellAttr) –
SetAlignment(self, hAlign, vAlign)¶Sets the alignment.
hAlign  can be one of  ALIGN_LEFT ,   ALIGN_CENTRE   or   ALIGN_RIGHT   and  vAlign  can be one of  ALIGN_TOP ,   ALIGN_CENTRE   or   ALIGN_BOTTOM .
hAlign (int) –
vAlign (int) –
SetDefAttr(self, defAttr)¶defAttr (wx.grid.GridCellAttr) –
Todo
Needs documentation.
SetEditor(self, editor)¶Sets the editor to be used with the cells with this attribute.
editor (wx.grid.GridCellEditor) –
SetOverflow(self, allow=True)¶allow (bool) –
SetReadOnly(self, isReadOnly=True)¶Sets the cell as read-only.
isReadOnly (bool) –
SetRenderer(self, renderer)¶Sets the renderer to be used for cells with this attribute.
Takes ownership of the pointer.
renderer (wx.grid.GridCellRenderer) –
SetSize(self, num_rows, num_cols)¶num_rows (int) –
num_cols (int) –
~wxGridCellAttr(self)The destructor is private because only DecRef   can delete us.
BackgroundColour¶Overflow¶See GetOverflow and SetOverflow
TextColour¶See GetTextColour and SetTextColour