.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2017 by Total Control Software License: wxWindows License .. include:: headings.inc .. _wx.grid.GridCellAttr: ========================================================================================================================================== |phoenix_title| **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 :meth:`wx.grid.GridTableBase.GetAttr` . | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class GridCellAttr:

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.grid.GridCellAttr.__init__` Default constructor. :meth:`~wx.grid.GridCellAttr.Clone` Creates a new copy of this object. :meth:`~wx.grid.GridCellAttr.DecRef` This class is reference counted: it is created with ref count of 1, so calling :meth:`~GridCellAttr.DecRef` once will delete it. :meth:`~wx.grid.GridCellAttr.GetAlignment` Get the alignment to use for the cell with the given attribute. :meth:`~wx.grid.GridCellAttr.GetBackgroundColour` Returns the background colour. :meth:`~wx.grid.GridCellAttr.GetEditor` Returns the cell editor. :meth:`~wx.grid.GridCellAttr.GetFont` Returns the font. :meth:`~wx.grid.GridCellAttr.GetKind` :meth:`~wx.grid.GridCellAttr.GetNonDefaultAlignment` Get the alignment defined by this attribute. :meth:`~wx.grid.GridCellAttr.GetOverflow` :meth:`~wx.grid.GridCellAttr.GetRenderer` Returns the cell renderer. :meth:`~wx.grid.GridCellAttr.GetSize` :meth:`~wx.grid.GridCellAttr.GetTextColour` Returns the text colour. :meth:`~wx.grid.GridCellAttr.HasAlignment` Returns ``True`` if this attribute has a valid alignment set. :meth:`~wx.grid.GridCellAttr.HasBackgroundColour` Returns ``True`` if this attribute has a valid background colour set. :meth:`~wx.grid.GridCellAttr.HasEditor` Returns ``True`` if this attribute has a valid cell editor set. :meth:`~wx.grid.GridCellAttr.HasFont` Returns ``True`` if this attribute has a valid font set. :meth:`~wx.grid.GridCellAttr.HasOverflowMode` :meth:`~wx.grid.GridCellAttr.HasReadWriteMode` :meth:`~wx.grid.GridCellAttr.HasRenderer` Returns ``True`` if this attribute has a valid cell renderer set. :meth:`~wx.grid.GridCellAttr.HasSize` :meth:`~wx.grid.GridCellAttr.HasTextColour` Returns ``True`` if this attribute has a valid text colour set. :meth:`~wx.grid.GridCellAttr.IncRef` This class is reference counted: it is created with ref count of 1, so calling :meth:`~GridCellAttr.DecRef` once will delete it. :meth:`~wx.grid.GridCellAttr.IsReadOnly` Returns ``True`` if this cell is set as read-only. :meth:`~wx.grid.GridCellAttr.MergeWith` :meth:`~wx.grid.GridCellAttr.SetAlignment` Sets the alignment. :meth:`~wx.grid.GridCellAttr.SetBackgroundColour` Sets the background colour. :meth:`~wx.grid.GridCellAttr.SetDefAttr` :meth:`~wx.grid.GridCellAttr.SetEditor` Sets the editor to be used with the cells with this attribute. :meth:`~wx.grid.GridCellAttr.SetFont` Sets the font. :meth:`~wx.grid.GridCellAttr.SetKind` :meth:`~wx.grid.GridCellAttr.SetOverflow` :meth:`~wx.grid.GridCellAttr.SetReadOnly` Sets the cell as read-only. :meth:`~wx.grid.GridCellAttr.SetRenderer` Sets the renderer to be used for cells with this attribute. :meth:`~wx.grid.GridCellAttr.SetSize` :meth:`~wx.grid.GridCellAttr.SetTextColour` Sets the text colour. :meth:`~wx.grid.GridCellAttr.~wxGridCellAttr` The destructor is private because only :meth:`~GridCellAttr.DecRef` can delete us. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.grid.GridCellAttr.BackgroundColour` See :meth:`~wx.grid.GridCellAttr.GetBackgroundColour` and :meth:`~wx.grid.GridCellAttr.SetBackgroundColour` :attr:`~wx.grid.GridCellAttr.Font` See :meth:`~wx.grid.GridCellAttr.GetFont` and :meth:`~wx.grid.GridCellAttr.SetFont` :attr:`~wx.grid.GridCellAttr.Kind` See :meth:`~wx.grid.GridCellAttr.GetKind` and :meth:`~wx.grid.GridCellAttr.SetKind` :attr:`~wx.grid.GridCellAttr.Overflow` See :meth:`~wx.grid.GridCellAttr.GetOverflow` and :meth:`~wx.grid.GridCellAttr.SetOverflow` :attr:`~wx.grid.GridCellAttr.TextColour` See :meth:`~wx.grid.GridCellAttr.GetTextColour` and :meth:`~wx.grid.GridCellAttr.SetTextColour` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: 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. .. method:: __init__(self, *args, **kw) |overload| Overloaded Implementations: **~~~** **__init__** `(self, attrDefault=None)` Default constructor. :param `attrDefault`: :type `attrDefault`: wx.grid.GridCellAttr **~~~** **__init__** `(self, colText, colBack, font, hAlign, vAlign)` Constructor specifying some of the often used attributes. :param `colText`: :type `colText`: wx.Colour :param `colBack`: :type `colBack`: wx.Colour :param `font`: :type `font`: wx.Font :param `hAlign`: :type `hAlign`: int :param `vAlign`: :type `vAlign`: int **~~~** .. method:: Clone(self) Creates a new copy of this object. :rtype: :ref:`wx.grid.GridCellAttr` .. method:: DecRef(self) This class is reference counted: it is created with ref count of 1, so calling :meth:`DecRef` once will delete it. Calling :meth:`IncRef` allows to lock it until the matching :meth:`DecRef` is called. .. method:: 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 :meth:`wx.grid.Grid.SetDefaultCellAlignment` but is left and top by default). Notice that `hAlign` and `vAlign` values are always overwritten by this function, use :meth:`GetNonDefaultAlignment` if this is not desirable. :rtype: `tuple` :returns: ( `hAlign`, `vAlign` ) .. method:: GetBackgroundColour(self) Returns the background colour. :rtype: `Colour` .. method:: GetEditor(self, grid, row, col) Returns the cell editor. :param `grid`: :type `grid`: wx.grid.Grid :param `row`: :type `row`: int :param `col`: :type `col`: int :rtype: :ref:`wx.grid.GridCellEditor` .. method:: GetFont(self) Returns the font. :rtype: `Font` .. method:: GetKind(self) :rtype: :ref:`wx.grid.GridCellAttr.AttrKind` .. method:: GetNonDefaultAlignment(self) Get the alignment defined by this attribute. Unlike :meth:`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() :rtype: `tuple` :returns: ( `hAlign`, `vAlign` ) .. versionadded:: 2.9.1 .. method:: GetOverflow(self) :rtype: `bool` .. method:: GetRenderer(self, grid, row, col) Returns the cell renderer. :param `grid`: :type `grid`: wx.grid.Grid :param `row`: :type `row`: int :param `col`: :type `col`: int :rtype: :ref:`wx.grid.GridCellRenderer` .. method:: GetSize(self) :rtype: `tuple` :returns: ( `num_rows`, `num_cols` ) .. method:: GetTextColour(self) Returns the text colour. :rtype: `Colour` .. method:: HasAlignment(self) Returns ``True`` if this attribute has a valid alignment set. :rtype: `bool` .. method:: HasBackgroundColour(self) Returns ``True`` if this attribute has a valid background colour set. :rtype: `bool` .. method:: HasEditor(self) Returns ``True`` if this attribute has a valid cell editor set. :rtype: `bool` .. method:: HasFont(self) Returns ``True`` if this attribute has a valid font set. :rtype: `bool` .. method:: HasOverflowMode(self) :rtype: `bool` .. method:: HasReadWriteMode(self) :rtype: `bool` .. method:: HasRenderer(self) Returns ``True`` if this attribute has a valid cell renderer set. :rtype: `bool` .. method:: HasSize(self) :rtype: `bool` .. method:: HasTextColour(self) Returns ``True`` if this attribute has a valid text colour set. :rtype: `bool` .. method:: IncRef(self) This class is reference counted: it is created with ref count of 1, so calling :meth:`DecRef` once will delete it. Calling :meth:`IncRef` allows to lock it until the matching :meth:`DecRef` is called. .. method:: IsReadOnly(self) Returns ``True`` if this cell is set as read-only. :rtype: `bool` .. method:: MergeWith(self, mergefrom) :param `mergefrom`: :type `mergefrom`: wx.grid.GridCellAttr .. method:: 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`` . :param `hAlign`: :type `hAlign`: int :param `vAlign`: :type `vAlign`: int .. method:: SetBackgroundColour(self, colBack) Sets the background colour. :param `colBack`: :type `colBack`: wx.Colour .. method:: SetDefAttr(self, defAttr) :param `defAttr`: :type `defAttr`: wx.grid.GridCellAttr .. todo:: Needs documentation. .. method:: SetEditor(self, editor) Sets the editor to be used with the cells with this attribute. :param `editor`: :type `editor`: wx.grid.GridCellEditor .. method:: SetFont(self, font) Sets the font. :param `font`: :type `font`: wx.Font .. method:: SetKind(self, kind) :param `kind`: :type `kind`: wx.grid.GridCellAttr.AttrKind .. method:: SetOverflow(self, allow=True) :param `allow`: :type `allow`: bool .. method:: SetReadOnly(self, isReadOnly=True) Sets the cell as read-only. :param `isReadOnly`: :type `isReadOnly`: bool .. method:: SetRenderer(self, renderer) Sets the renderer to be used for cells with this attribute. Takes ownership of the pointer. :param `renderer`: :type `renderer`: wx.grid.GridCellRenderer .. method:: SetSize(self, num_rows, num_cols) :param `num_rows`: :type `num_rows`: int :param `num_cols`: :type `num_cols`: int .. method:: SetTextColour(self, colText) Sets the text colour. :param `colText`: :type `colText`: wx.Colour .. method:: ~wxGridCellAttr(self) The destructor is private because only :meth:`DecRef` can delete us. .. attribute:: BackgroundColour See :meth:`~wx.grid.GridCellAttr.GetBackgroundColour` and :meth:`~wx.grid.GridCellAttr.SetBackgroundColour` .. attribute:: Font See :meth:`~wx.grid.GridCellAttr.GetFont` and :meth:`~wx.grid.GridCellAttr.SetFont` .. attribute:: Kind See :meth:`~wx.grid.GridCellAttr.GetKind` and :meth:`~wx.grid.GridCellAttr.SetKind` .. attribute:: Overflow See :meth:`~wx.grid.GridCellAttr.GetOverflow` and :meth:`~wx.grid.GridCellAttr.SetOverflow` .. attribute:: TextColour See :meth:`~wx.grid.GridCellAttr.GetTextColour` and :meth:`~wx.grid.GridCellAttr.SetTextColour` .. toctree:: :maxdepth: 1 :hidden: wx.grid.GridCellAttr.AttrKind.enumeration