Phoenix Logo

phoenix_title wx.grid.GridCellAttrProvider

Class providing attributes to be used for the grid cells.

This class both defines an interface which grid cell attributes providers should implement

An object of this class can be associated with a wx.grid.Grid using wx.grid.GridTableBase.SetAttrProvider but it’s not necessary to call it if you intend to use the default provider as it is used by wx.grid.GridTableBase by default anyhow.

Notice that while attributes provided by this class can be set for individual cells using SetAttr or the entire rows or columns using SetRowAttr and SetColAttr they are always retrieved using GetAttr function.

The default implementation of this class stores the attributes passed to its SetAttr, SetRowAttr and SetColAttr in a straightforward way. A derived class may use its knowledge about how the attributes are used in your program to implement it much more efficiently: for example, using a special background colour for all even-numbered rows can be implemented by simply returning the same attribute from GetAttr if the row number is even instead of having to store N/2 row attributes where N is the total number of rows in the grid.

Notice that objects of this class can’t be copied.


class_hierarchy Class Hierarchy

Inheritance diagram for class GridCellAttrProvider:

method_summary Methods Summary

__init__ Trivial default constructor.
GetAttr Get the attribute to use for the specified cell.
GetColumnHeaderRenderer Return the renderer used for drawing column headers.
GetCornerRenderer Return the renderer used for drawing the corner window.
GetRowHeaderRenderer Return the renderer used for drawing row headers.
SetAttr Set attribute for the specified cell.
SetColAttr Set attribute for the specified column.
SetRowAttr Set attribute for the specified row.

property_summary Properties Summary

CornerRenderer See GetCornerRenderer

api Class API



class wx.grid.GridCellAttrProvider(ClientDataContainer)

Possible constructors:

GridCellAttrProvider()

Class providing attributes to be used for the grid cells.


Methods



__init__(self)

Trivial default constructor.



GetAttr(self, row, col, kind)

Get the attribute to use for the specified cell.

If wx.grid.GridCellAttr.Any is used as kind value, this function combines the attributes set for this cell using SetAttr and those for its row or column (set with SetRowAttr or SetColAttr respectively), with the cell attribute having the highest precedence.

Notice that the caller must call DecRef() on the returned pointer if it is not None.

Parameters:
  • row (int) – The row of the cell.
  • col (int) – The column of the cell.
  • kind (GridCellAttr.wxAttrKind) – The kind of the attribute to return.
Return type:

wx.grid.GridCellAttr

Returns:

The attribute to use which should be DecRef()’d by caller or None if no attributes are defined for this cell.



GetColumnHeaderRenderer(self, col)

Return the renderer used for drawing column headers.

By default wx.grid.GridColumnHeaderRendererDefault is returned.

Parameters:col (int) –
Return type: wx.grid.GridColumnHeaderRenderer

New in version 2.9.1.



GetCornerRenderer(self)

Return the renderer used for drawing the corner window.

By default wx.grid.GridCornerHeaderRendererDefault is returned.

Return type: wx.grid.GridCornerHeaderRenderer

New in version 2.9.1.



GetRowHeaderRenderer(self, row)

Return the renderer used for drawing row headers.

By default wx.grid.GridRowHeaderRendererDefault is returned.

Parameters:row (int) –
Return type: wx.grid.GridRowHeaderRenderer

New in version 2.9.1.



SetAttr(self, attr, row, col)

Set attribute for the specified cell.

Parameters:


SetColAttr(self, attr, col)

Set attribute for the specified column.

Parameters:


SetRowAttr(self, attr, row)

Set attribute for the specified row.

Parameters:

Properties



CornerRenderer

See GetCornerRenderer