# wx.richtext.RichTextCell¶

wx.richtext.RichTextCell is the cell in a table, in which the user can type.

As well as text, it can also contain objects e.g. an image, or even another wx.richtext.RichTextTable.

A cell’s appearance can be changed via its associated wx.richtext.RichTextAttr; for example its size altered or its background colour set. It also has the properties of column- and row-span. By default these are 1, meaning that the cell only spans itself, but can be increased using the SetColSpan and SetRowSpan methods. Attempts to set too large a span are silently truncated to the table edge.

## Class Hierarchy¶

Inheritance diagram for class RichTextCell:

## Methods Summary¶

 __init__ Default constructor; optionally pass the parent object. CanEditProperties Returns True if we can edit the object’s properties via a GUI. Clone Clones the object. Copy Draw Draw the item, within the given range. EditProperties Edits the object’s properties via a GUI. GetColSpan Returns the number of columns spanned by the cell. GetPropertiesMenuLabel Returns the label to be used for the properties context menu item. GetRowSpan Returns the number of rows spanned by the cell. GetXMLNodeName Returns the XML node name of this object. HitTest Hit-testing: returns a flag indicating hit test details, plus information about position. SetColSpan Set the number of columns spanned by the cell. SetRowSpan Set the number of rows spanned by the cell.

## Class API¶

class wx.richtext.RichTextCell(RichTextBox)

Possible constructors:

RichTextCell(parent=None)

RichTextCell(obj)


RichTextCell is the cell in a table, in which the user can type.

### Methods¶

__init__(self, *args, **kw)

__init__ (self, parent=None)

Default constructor; optionally pass the parent object.

Parameters

parent (wx.richtext.RichTextObject) –

__init__ (self, obj)

Copy constructor.

Parameters

obj (wx.richtext.RichTextCell) –

CanEditProperties(self)

Returns True if we can edit the object’s properties via a GUI.

Return type

bool

Clone(self)

Clones the object.

Return type

wx.richtext.RichTextObject

Copy(self, obj)
Parameters

obj (wx.richtext.RichTextCell) –

Draw(self, dc, context, range, selection, rect, descent, style)

Draw the item, within the given range.

Some objects may ignore the range (for example paragraphs) while others must obey it (lines, to implement wrapping)

Parameters
Return type

bool

EditProperties(self, parent, buffer)

Edits the object’s properties via a GUI.

Parameters
Return type

bool

GetColSpan(self)

Returns the number of columns spanned by the cell.

By default a cell doesn’t span extra columns, so this function returns 1.

Return type

int

New in version 2.9.5.

GetPropertiesMenuLabel(self)

Returns the label to be used for the properties context menu item.

Return type

string

GetRowSpan(self)

Returns the number of rows spanned by the cell.

By default a cell doesn’t span extra rows, so this function returns 1.

Return type

int

New in version 2.9.5.

GetXMLNodeName(self)

Returns the XML node name of this object.

This must be overridden for XmlNode-base XML export to work.

Return type

string

HitTest(self, dc, context, pt, flags=0)

Hit-testing: returns a flag indicating hit test details, plus information about position.

contextObj is returned to specify what object position is relevant to, since otherwise there’s an ambiguity. @ obj might not be a child of contextObj, since we may be referring to the container itself if we have no hit on a child - for example if we click outside an object.

The function puts the position in textPosition if one is found. pt is in logical units (a zero y position is at the beginning of the buffer).

Parameters
Return type

tuple

Returns

( int, textPosition, obj, contextObj )

SetColSpan(self, span)

Set the number of columns spanned by the cell.

By default colspan is 1 i.e. a cell doesn’t span extra columns. Pass a value >1 to change this. Attempting to set a colspan <1 will assert and be ignored.

Parameters

span (long) –

New in version 2.9.5.

SetRowSpan(self, span)

Set the number of rows spanned by the cell.

By default colspan is 1 i.e. a cell doesn’t span extra rows. Pass a value >1 to change this. Attempting to set a rowspan <1 will assert and be ignored.

Parameters

span (long) –

New in version 2.9.5.

### Properties¶

ColSpan

PropertiesMenuLabel

RowSpan

XMLNodeName