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
.
__init__ |
Default constructor. |
Clone |
Creates a new copy of this object. |
DecRef |
This class is reference counted: it is created with ref count of 1, so calling DecRef once will delete it. |
GetAlignment |
Get the alignment to use for the cell with the given attribute. |
GetBackgroundColour |
Returns the background colour. |
GetEditor |
Returns the cell editor. |
GetFont |
Returns the font. |
GetKind |
|
GetNonDefaultAlignment |
Get the alignment defined by this attribute. |
GetOverflow |
|
GetRenderer |
Returns the cell renderer. |
GetSize |
|
GetTextColour |
Returns the text colour. |
HasAlignment |
Returns True if this attribute has a valid alignment set. |
HasBackgroundColour |
Returns True if this attribute has a valid background colour set. |
HasEditor |
Returns True if this attribute has a valid cell editor set. |
HasFont |
Returns True if this attribute has a valid font set. |
HasOverflowMode |
|
HasReadWriteMode |
|
HasRenderer |
Returns True if this attribute has a valid cell renderer set. |
HasSize |
|
HasTextColour |
Returns True if this attribute has a valid text colour set. |
IncRef |
This class is reference counted: it is created with ref count of 1, so calling DecRef once will delete it. |
IsReadOnly |
Returns True if this cell is set as read-only. |
MergeWith |
|
SetAlignment |
Sets the alignment. |
SetBackgroundColour |
Sets the background colour. |
SetDefAttr |
|
SetEditor |
Sets the editor to be used with the cells with this attribute. |
SetFont |
Sets the font. |
SetKind |
|
SetOverflow |
|
SetReadOnly |
Sets the cell as read-only. |
SetRenderer |
Sets the renderer to be used for cells with this attribute. |
SetSize |
|
SetTextColour |
Sets the text colour. |
~wxGridCellAttr |
The destructor is private because only DecRef can delete us. |
BackgroundColour |
See GetBackgroundColour and SetBackgroundColour |
Font |
See GetFont and SetFont |
Kind |
See GetKind and SetKind |
Overflow |
See GetOverflow and SetOverflow |
TextColour |
See GetTextColour and SetTextColour |
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.
Parameters: | attrDefault (wx.grid.GridCellAttr) – |
---|
__init__ (self, colText, colBack, font, hAlign, vAlign)
Constructor specifying some of the often used attributes.
Parameters: |
---|
Clone
(self)¶Creates a new copy of this object.
Return type: | wx.grid.GridCellAttr |
---|
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 to lock 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.
Return type: | tuple |
---|---|
Returns: | ( hAlign, vAlign ) |
GetBackgroundColour
(self)¶Returns the background colour.
Return type: | Colour |
---|
GetEditor
(self, grid, row, col)¶Returns the cell editor.
Parameters: |
|
---|---|
Return type: |
GetKind
(self)¶Return type: | wx.grid.GridCellAttr.AttrKind |
---|
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()
Return type: | tuple |
---|---|
Returns: | ( hAlign, vAlign ) |
New in version 2.9.1.
GetOverflow
(self)¶Return type: | bool |
---|
GetRenderer
(self, grid, row, col)¶Returns the cell renderer.
Parameters: |
|
---|---|
Return type: |
GetSize
(self)¶Return type: | tuple |
---|---|
Returns: | ( num_rows, num_cols ) |
GetTextColour
(self)¶Returns the text colour.
Return type: | Colour |
---|
HasAlignment
(self)¶Returns True
if this attribute has a valid alignment set.
Return type: | bool |
---|
HasBackgroundColour
(self)¶Returns True
if this attribute has a valid background colour set.
Return type: | bool |
---|
HasEditor
(self)¶Returns True
if this attribute has a valid cell editor set.
Return type: | bool |
---|
HasFont
(self)¶Returns True
if this attribute has a valid font set.
Return type: | bool |
---|
HasOverflowMode
(self)¶Return type: | bool |
---|
HasReadWriteMode
(self)¶Return type: | bool |
---|
HasRenderer
(self)¶Returns True
if this attribute has a valid cell renderer set.
Return type: | bool |
---|
HasSize
(self)¶Return type: | bool |
---|
HasTextColour
(self)¶Returns True
if this attribute has a valid text colour set.
Return type: | 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 to lock it until the matching DecRef
is called.
IsReadOnly
(self)¶Returns True
if this cell is set as read-only.
Return type: | bool |
---|
MergeWith
(self, mergefrom)¶Parameters: | 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
.
Parameters: |
|
---|
SetDefAttr
(self, defAttr)¶Parameters: | defAttr (wx.grid.GridCellAttr) – |
---|
Todo
Needs documentation.
SetEditor
(self, editor)¶Sets the editor to be used with the cells with this attribute.
Parameters: | editor (wx.grid.GridCellEditor) – |
---|
SetOverflow
(self, allow=True)¶Parameters: | allow (bool) – |
---|
SetReadOnly
(self, isReadOnly=True)¶Sets the cell as read-only.
Parameters: | isReadOnly (bool) – |
---|
SetRenderer
(self, renderer)¶Sets the renderer to be used for cells with this attribute.
Takes ownership of the pointer.
Parameters: | renderer (wx.grid.GridCellRenderer) – |
---|
SetSize
(self, num_rows, num_cols)¶Parameters: |
|
---|
~wxGridCellAttr(self)
The destructor is private because only DecRef
can delete us.
BackgroundColour
¶Overflow
¶See GetOverflow
and SetOverflow
TextColour
¶See GetTextColour
and SetTextColour