# wx.dataview.DataViewItemAttr¶

This class is used to indicate to a wx.dataview.DataViewCtrl that a certain item (see wx.dataview.DataViewItem) has extra font attributes for its renderer.

For this, it is required to override wx.dataview.DataViewModel.GetAttr .

Attributes are currently only supported by DataViewTextRendererText.

## Class Hierarchy¶

Inheritance diagram for class DataViewItemAttr:

## Methods Summary¶

 __init__ Constructor. GetBackgroundColour Returns the colour to be used for the background. GetBold Returns value of the bold property. GetColour Returns this attribute’s colour. GetEffectiveFont Return the font based on the given one with this attribute applied to it. GetItalic Returns value of the italics property. HasBackgroundColour Returns True if the background colour property has been set. HasColour Returns True if the colour property has been set. HasFont Returns True if any property affecting the font has been set. IsDefault Returns True if none of the properties have been set. SetBackgroundColour Call this to set the background colour to use. SetBold Call this to indicate that the item shall be displayed in bold text. SetColour Call this to indicate that the item shall be displayed with that colour. SetItalic Call this to indicate that the item shall be displayed in italic text. SetStrikethrough Call this to indicate that the item shall be displayed in strikethrough text.

## Class API¶

class wx.dataview.DataViewItemAttr(object)

Possible constructors:

DataViewItemAttr()


This class is used to indicate to a DataViewCtrl that a certain item (see DataViewItem) has extra font attributes for its renderer.

### Methods¶

__init__(self)

Constructor.

GetBackgroundColour(self)

Returns the colour to be used for the background.

Return type

Colour

GetBold(self)

Returns value of the bold property.

Return type

bool

GetColour(self)

Returns this attribute’s colour.

Return type

Colour

GetEffectiveFont(self, font)

Return the font based on the given one with this attribute applied to it.

Parameters

font (wx.Font) –

Return type

Font

GetItalic(self)

Returns value of the italics property.

Return type

bool

HasBackgroundColour(self)

Returns True if the background colour property has been set.

Return type

bool

HasColour(self)

Returns True if the colour property has been set.

Return type

bool

HasFont(self)

Returns True if any property affecting the font has been set.

Return type

bool

IsDefault(self)

Returns True if none of the properties have been set.

Return type

bool

SetBackgroundColour(self, colour)

Call this to set the background colour to use.

Parameters

colour (wx.Colour) –

New in version 2.9.4: - Generic

New in version 4.1/wxWidgets-3.1.1: - wxGTK

New in version 4.1/wxWidgets-3.1.4: - wxOSX

SetBold(self, set)

Call this to indicate that the item shall be displayed in bold text.

Parameters

set (bool) –

SetColour(self, colour)

Call this to indicate that the item shall be displayed with that colour.

Parameters

colour (wx.Colour) –

SetItalic(self, set)

Call this to indicate that the item shall be displayed in italic text.

Parameters

set (bool) –

SetStrikethrough(self, set)

Call this to indicate that the item shall be displayed in strikethrough text.

Currently this attribute is only supported in the generic version of wx.dataview.DataViewCtrl and GTK and ignored by the native macOS implementations.

Parameters

set (bool) –

New in version 4.1/wxWidgets-3.1.2.

### Properties¶

BackgroundColour

Bold

Colour

Italic