Represents a column header in controls displaying tabular data such as wx.dataview.DataViewCtrl or wx.grid.Grid.

Notice that this is an abstract base class which is implemented (usually using the information stored in the associated control) by the different controls using wx.HeaderCtrl. As the control only needs to retrieve the information about the column, this class defines only the methods for accessing the various column properties but not for changing them as the setters might not be needed at all, e.g. if the column attributes can only be changed via the methods of the main associated control (this is the case for wx.grid.Grid for example). If you do want to allow changing them directly using the column itself, you should inherit from wx.SettableHeaderColumn instead of this class.

Finally, if you don’t already store the column information at all anywhere, you should use the concrete wx.HeaderColumnSimple class and wx.HeaderCtrlSimple.

## Methods Summary¶

 GetAlignment Returns the current column alignment. GetBitmap Returns the bitmap in the header of the column, if any. GetFlags Get the column flags. GetMinWidth Return the minimal column width. GetTitle Get the text shown in the column header. GetWidth Returns the current width of the column. HasFlag Return True if the specified flag is currently set for this column. IsHidden Returns True if the column is currently hidden. IsReorderable Returns True if the column can be dragged by user to change its order. IsResizeable Return True if the column can be resized by the user. IsShown Returns True if the column is currently shown. IsSortKey Returns True if the column is currently used for sorting. IsSortOrderAscending Returns True, if the sort order is ascending. IsSortable Returns True if the column can be clicked by user to sort the control contents by the field in this column.

## Class API¶

class wx.HeaderColumn(object)

Represents a column header in controls displaying tabular data such as DataViewCtrl or Grid.

### Methods¶

GetAlignment(self)

Returns the current column alignment.

Return type

wx.Alignment

Returns

One of wx.ALIGN_CENTRE, wx.ALIGN_LEFT or wx.ALIGN_RIGHT.

GetBitmap(self)

Returns the bitmap in the header of the column, if any.

If the column has no associated bitmap, NullBitmap should be returned.

Return type

wx.Bitmap

GetFlags(self)

Get the column flags.

This method retrieves all the flags at once, you can also use HasFlag to test for any individual flag or IsResizeable , IsSortable , IsReorderable and IsHidden to test for particular flags.

Return type

int

GetMinWidth(self)

Return the minimal column width.

Return type

int

Returns

The minimal width such that the user can’t resize the column to lesser size (notice that it is still possible to set the column width to smaller value from the program code). Return 0 from here to allow resizing the column to arbitrarily small size.

GetTitle(self)

Get the text shown in the column header.

Return type

string

GetWidth(self)

Returns the current width of the column.

Return type

int

Returns

Width of the column in pixels, never wx.COL_WIDTH_DEFAULT or wx.COL_WIDTH_AUTOSIZE.

HasFlag(self, flag)

Return True if the specified flag is currently set for this column.

Parameters

flag (int) –

Return type

bool

IsHidden(self)

Returns True if the column is currently hidden.

This corresponds to wx.COL_HIDDEN flag which is off by default.

Return type

bool

IsReorderable(self)

Returns True if the column can be dragged by user to change its order.

This corresponds to wx.COL_REORDERABLE flag which is on by default.

Return type

bool

IsResizeable(self)

Return True if the column can be resized by the user.

Equivalent to HasFlag(wxCOL_RESIZABLE).

Return type

bool

IsShown(self)

Returns True if the column is currently shown.

This corresponds to the absence of wx.COL_HIDDEN flag.

Return type

bool

IsSortKey(self)

Returns True if the column is currently used for sorting.

Return type

bool

IsSortOrderAscending(self)

Returns True, if the sort order is ascending.

Notice that it only makes sense to call this function if the column is used for sorting at all, i.e. if IsSortKey returns True.

Return type

bool

IsSortable(self)

Returns True if the column can be clicked by user to sort the control contents by the field in this column.

This corresponds to wx.COL_SORTABLE flag which is off by default.

Return type

bool

### Properties¶

Alignment

Bitmap

Flags

Hidden

MinWidth

Reorderable

Resizeable

Shown

SortKey

SortOrderAscending

Sortable

Title

Width