wx.ListItem¶This class stores information about a wx.ListCtrl item or column.
wx.ListItem is a class which contains information about:
SetId and GetId.SetColumn and GetColumn.SetText and GetText.GetImage and SetImage.SetData and GetData.SetWidth and GetWidth.LIST_FORMAT_LEFT , LIST_FORMAT_RIGHT , LIST_FORMAT_CENTRE . See SetAlign and GetAlign.SetState and GetState. This is a bitlist of the following flags:LIST_STATE_FOCUSED: The item has the focus.LIST_STATE_SELECTED: The item is selected.LIST_STATE_DONTCARE: Don’t care what the state is. Win32 only.LIST_STATE_DROPHILITED: The item is highlighted to receive a drop event. Win32 only.LIST_STATE_CUT: The item is in the cut state. Win32 only.SetStateMask and GetStateMask().SetMask and GetMask. This is a bitlist of the following flags:LIST_MASK_STATE: The state field is valid.LIST_MASK_TEXT: The label field is valid.LIST_MASK_IMAGE: The image field is valid.LIST_MASK_DATA: The application-defined data field is valid.LIST_MASK_WIDTH: The column width field is valid.LIST_MASK_FORMAT: The column format field is valid.The wx.ListItem object can also contain item-specific colour and font information: for this you need to call one of SetTextColour, SetBackgroundColour or SetFont functions on it passing it the colour/font to use. If the colour/font is not specified, the default list control colour/font is used.
See also
Methods Summary¶__init__ |
Constructor. |
Clear |
Resets the item state to the default. |
GetAlign |
Returns the alignment for this item. |
GetBackgroundColour |
Returns the background colour for this item. |
GetColumn |
Returns the zero-based column; meaningful only in report mode. |
GetData |
Returns client data associated with the control. |
GetFont |
Returns the font used to display the item. |
GetId |
Returns the zero-based item position. |
GetImage |
Returns the zero-based index of the image associated with the item into the image list. |
GetMask |
Returns a bit mask indicating which fields of the structure are valid. |
GetState |
Returns a bit field representing the state of the item. |
GetText |
Returns the label/header text. |
GetTextColour |
Returns the text colour. |
GetWidth |
Meaningful only for column headers in report mode. |
SetAlign |
Sets the alignment for the item. |
SetBackgroundColour |
Sets the background colour for the item. |
SetColumn |
Sets the zero-based column. |
SetData |
Sets client data for the item. |
SetFont |
Sets the font for the item. |
SetId |
Sets the zero-based item position. |
SetImage |
Sets the zero-based index of the image associated with the item into the image list. |
SetMask |
Sets the mask of valid fields. |
SetState |
Sets the item state flags (note that the valid state flags are influenced by the value of the state mask, see wx.ListItem.SetStateMask ). |
SetStateMask |
Sets the bitmask that is used to determine which of the state flags are to be set. |
SetText |
Sets the text label for the item. |
SetTextColour |
Sets the text colour for the item. |
SetWidth |
Meaningful only for column headers in report mode. |
Properties Summary¶Align |
See GetAlign and SetAlign |
BackgroundColour |
See GetBackgroundColour and SetBackgroundColour |
Column |
See GetColumn and SetColumn |
Data |
See GetData and SetData |
Font |
See GetFont and SetFont |
Id |
See GetId and SetId |
Image |
See GetImage and SetImage |
Mask |
See GetMask and SetMask |
State |
See GetState and SetState |
Text |
See GetText and SetText |
TextColour |
See GetTextColour and SetTextColour |
Width |
See GetWidth and SetWidth |
Class API¶wx.ListItem(Object)¶Possible constructors:
ListItem()
This class stores information about a ListCtrl item or column.
__init__(self)¶Constructor.
Clear(self)¶Resets the item state to the default.
GetAlign(self)¶Returns the alignment for this item.
Can be one of LIST_FORMAT_LEFT , LIST_FORMAT_RIGHT or LIST_FORMAT_CENTRE .
| Return type: | wx.ListColumnFormat |
|---|
GetColumn(self)¶Returns the zero-based column; meaningful only in report mode.
| Return type: | int |
|---|
GetData(self)¶Returns client data associated with the control.
Please note that client data is associated with the item and not with subitems.
| Return type: | long |
|---|
GetId(self)¶Returns the zero-based item position.
| Return type: | long |
|---|
GetImage(self)¶Returns the zero-based index of the image associated with the item into the image list.
| Return type: | int |
|---|
GetMask(self)¶Returns a bit mask indicating which fields of the structure are valid.
Can be any combination of the following values:
wx.LIST_MASK_STATE: GetState is valid.wx.LIST_MASK_TEXT: GetText is valid.wx.LIST_MASK_IMAGE: GetImage is valid.wx.LIST_MASK_DATA: GetData is valid.wx.LIST_MASK_WIDTH: GetWidth is valid.wx.LIST_MASK_FORMAT: GetFormat is valid.| Return type: | long |
|---|
GetState(self)¶Returns a bit field representing the state of the item.
Can be any combination of:
wx.LIST_STATE_DONTCARE: Don’t care what the state is. Win32 only.wx.LIST_STATE_DROPHILITED: The item is highlighted to receive a drop event. Win32 only.wx.LIST_STATE_FOCUSED: The item has the focus.wx.LIST_STATE_SELECTED: The item is selected.wx.LIST_STATE_CUT: The item is in the cut state. Win32 only.| Return type: | long |
|---|
GetText(self)¶Returns the label/header text.
| Return type: | string |
|---|
GetWidth(self)¶Meaningful only for column headers in report mode.
Returns the column width.
| Return type: | int |
|---|
SetAlign(self, align)¶Sets the alignment for the item.
See also GetAlign
| Parameters: | align (ListColumnFormat) – |
|---|
SetBackgroundColour(self, colBack)¶Sets the background colour for the item.
| Parameters: | colBack (wx.Colour) – |
|---|
SetColumn(self, col)¶Sets the zero-based column.
Meaningful only in report mode.
| Parameters: | col (int) – |
|---|
SetData(self, data)¶Sets client data for the item.
Please note that client data is associated with the item and not with subitems.
| Parameters: | data (long) – |
|---|
SetId(self, id)¶Sets the zero-based item position.
| Parameters: | id (long) – |
|---|
SetImage(self, image)¶Sets the zero-based index of the image associated with the item into the image list.
| Parameters: | image (int) – |
|---|
SetState(self, state)¶Sets the item state flags (note that the valid state flags are influenced by the value of the state mask, see wx.ListItem.SetStateMask ).
See GetState for valid flag values.
| Parameters: | state (long) – |
|---|
SetStateMask(self, stateMask)¶Sets the bitmask that is used to determine which of the state flags are to be set.
See also SetState .
| Parameters: | stateMask (long) – |
|---|
SetText(self, text)¶Sets the text label for the item.
| Parameters: | text (string) – |
|---|
SetWidth(self, width)¶Meaningful only for column headers in report mode.
Sets the column width.
| Parameters: | width (int) – |
|---|
BackgroundColour¶TextColour¶See GetTextColour and SetTextColour