.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.agw.customtreectrl
.. highlight:: python
.. _wx.lib.agw.customtreectrl.GenericTreeItem:
==========================================================================================================================================
|phoenix_title| **wx.lib.agw.customtreectrl.GenericTreeItem**
==========================================================================================================================================
This class holds all the information and methods for every single item in
:class:`CustomTreeCtrl`. This is a generic implementation of :class:`TreeItem`.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
GenericTreeItem:
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.__init__` Default class constructor.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.AssignAttributes` Assigns the item attributes (font, colours, etc...) for this item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Attr` Creates a new attribute (font, colours, etc...) for this item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Check` Checks/unchecks an item. Internal use only.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Collapse` Collapses the item. Internal use only.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.DeleteChildren` Deletes the item children. Internal use only.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.DeleteWindow` Deletes the window associated to the item (if any). Internal use only.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Enable` Enables/disables the item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Expand` Expands the item. Internal use only.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Get3StateValue` Gets the state of a 3-state checkbox item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetAttributes` Returns the item attributes (font, colours, etc...).
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetCheckedImage` Returns the item check image.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetChildren` Returns the item's children.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetChildrenCount` Gets the number of children of this item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetCurrentCheckedImage` Returns the current item check image.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetCurrentImage` Returns the current item image.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetData` Returns the data associated to this item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetHeight` Returns the height of the item, in pixels.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetImage` Returns the item image for a particular item state.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetLeftImage` Returns the leftmost image associated to this item, i.e. the image on the
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetParent` Gets the item parent (another instance of :class:`GenericTreeItem` or ``None`` for
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetSize` Returns the item size.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetText` Returns the item text.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetType` Returns the item type.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetValue` Returns whether the item is checked or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetVisited` Returns whether an hypertext item was visited or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetWidth` Returns the width of the item's contents, in pixels.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetWindow` Returns the window associated to the item (if any).
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetWindowEnabled` Returns whether the associated window is enabled or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetWindowSize` Returns the associated window size.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetX` Returns the `x` position on an item, in logical coordinates.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.GetY` Returns the `y` position on an item, in logical coordinates.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.HasChildren` Returns whether the item has children or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.HasPlus` Returns whether the item has the plus button or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Hide` Hides/shows the item. Internal use only.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.HitTest` :meth:`~GenericTreeItem.HitTest` method for an item. Called from the main window :meth:`CustomTreeCtrl.HitTest() `.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Insert` Inserts an item in the item children list for this item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Is3State` Returns whether or not the checkbox item is a 3-state checkbox.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsBold` Returns whether the item font is bold or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsChecked` This is just a maybe more readable synonym for :meth:`~GenericTreeItem.GetValue`.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsEnabled` Returns whether the item is enabled or not. Hidden items always return False.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsExpanded` Returns whether the item is expanded or not. Hidden items always return False.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsHidden` Returns whether the item is hidden or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsHyperText` Returns whether the item is hypetext or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsItalic` Returns whether the item font is italic or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsOk` Returns whether the item is ok or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsSelected` Returns whether the item is selected or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.IsSeparator` Returns whether the item is meant to be an horizontal line separator or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.OnSetFocus` Handles the ``wx.EVT_SET_FOCUS`` event for the window associated with the item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.OnTreeItemCollapsing` Handles the ``wx.EVT_TREE_ITEM_COLLAPSING`` event for the window associated with the item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Set3State` Sets whether the item has a 3-state value checkbox assigned to it or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.Set3StateValue` Sets the checkbox item to the given `state`.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetAttributes` Sets the item attributes (font, colours, etc...).
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetBold` Sets the item font bold.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetData` Sets the data associated to this item.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetHasPlus` Sets whether an item has the 'plus' button.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetHeight` Sets the item's height. Used internally.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetHilight` Sets the item focus/unfocus.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetHyperText` Sets whether the item is hypertext or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetImage` Sets the item image.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetItalic` Sets the item font italic.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetLeftImage` Sets the item leftmost image, i.e. the image associated to the item on the leftmost
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetText` Sets the item text.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetType` Sets the item type.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetVisited` Sets whether an hypertext item was visited or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetWidth` Sets the item's width. Used internally.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetWindow` Sets the window associated to the item. Internal use only.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetWindowEnabled` Sets whether the associated window is enabled or not.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetX` Sets the `x` position on an item, in logical coordinates.
:meth:`~wx.lib.agw.customtreectrl.GenericTreeItem.SetY` Sets the `y` position on an item, in logical coordinates.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: GenericTreeItem(object)
This class holds all the information and methods for every single item in
:class:`CustomTreeCtrl`. This is a generic implementation of :class:`TreeItem`.
.. method:: __init__(self, parent, text="", ct_type=0, wnd=None, image=-1, selImage=-1, data=None, separator=False, on_the_right=True)
Default class constructor.
For internal use: do not call it in your code!
:param `parent`: the tree item parent, an instance of :class:`GenericTreeItem` (may
be ``None`` for root items);
:param string `text`: the tree item text;
:param integer `ct_type`: the tree item kind. May be one of the following integers:
=============== =========================================
`ct_type` Value Description
=============== =========================================
0 A normal item
1 A checkbox-like item
2 A radiobutton-type item
=============== =========================================
:param `wnd`: if not ``None``, a non-toplevel window to be displayed next to
the item, an instance of :class:`wx.Window`;
:param integer `image`: an index within the normal image list specifying the image to
use for the item in unselected state;
:param integer `selImage`: an index within the normal image list specifying the image to
use for the item in selected state; if `image` > -1 and `selImage` is -1, the
same image is used for both selected and unselected items;
:param object `data`: associate the given Python object `data` with the item;
:param bool `separator`: ``True`` if the item is a separator, ``False`` otherwise.
:param bool `on_the_right`: ``True`` positions the window on the right of text, ``False``
on the left of text and overlapping the image.
.. note:: Regarding radiobutton-type items (with `ct_type` = 2), the following
approach is used:
- All peer-nodes that are radiobuttons will be mutually exclusive. In other words,
only one of a set of radiobuttons that share a common parent can be checked at
once. If a radiobutton node becomes checked, then all of its peer radiobuttons
must be unchecked.
- If a radiobutton node becomes unchecked, then all of its child nodes will become
inactive.
.. note:: Separator items should not have children, labels, data or an associated window.
Other issues/features associated to separator items:
- You can change the color of individual separators by using :meth:`CustomTreeCtrl.SetItemTextColour() `,
or you can use :meth:`CustomTreeCtrl.SetSeparatorColour() ` to change the color of all
separators. The default separator colour is that returned by `SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT)`;
- Separators can be selected just like any other tree item;
- Separators cannot have text;
- Separators cannot have children;
- Separators cannot be edited via the ``EVT_TREE_BEGIN_LABEL_EDIT`` event.
.. method:: AssignAttributes(self, attr)
Assigns the item attributes (font, colours, etc...) for this item.
:param `attr`: an instance of :class:`TreeItemAttr`.
.. method:: Attr(self)
Creates a new attribute (font, colours, etc...) for this item.
:return: An instance of :class:`TreeItemAttr`.
.. method:: Check(self, checked=True)
Checks/unchecks an item. Internal use only.
:param bool `checked`: ``True`` to check an item, ``False`` to uncheck it.
.. note:: This is meaningful only for checkbox-like and radiobutton-like items.
.. note:: Always use :meth:`CustomTreeCtrl.CheckItem` instead to update the tree properly and send events.
.. method:: Collapse(self)
Collapses the item. Internal use only.
.. note:: Always use :meth:`CustomTreeCtrl.Collapse` instead to update the tree properly and send events.
.. method:: DeleteChildren(self, tree)
Deletes the item children. Internal use only.
:param `tree`: the main :class:`CustomTreeCtrl` instance.
.. note:: Always use :meth:`CustomTreeCtrl.DeleteChildren` instead to update the tree properly.
.. method:: DeleteWindow(self)
Deletes the window associated to the item (if any). Internal use only.
.. note:: Always use :meth:`CustomTreeCtrl.DeleteItemWindow` instead to update the tree properly.
.. method:: Enable(self, enable=True)
Enables/disables the item.
:param bool `enable`: ``True`` to enable the item, ``False`` to disable it.
.. note:: Call :meth:`CustomTreeCtrl.EnableItem` instead to update the tree properly.
.. method:: Expand(self)
Expands the item. Internal use only.
.. note:: Always use :meth:`CustomTreeCtrl.Expand` instead to update the tree properly and send events.
.. method:: Get3StateValue(self)
Gets the state of a 3-state checkbox item.
:return: ``wx.CHK_UNCHECKED`` when the checkbox is unchecked, ``wx.CHK_CHECKED``
when it is checked and ``wx.CHK_UNDETERMINED`` when it's in the undetermined
state.
:raise: `Exception` when the item is not a 3-state checkbox item.
.. note:: This method raises an exception when the function is used with a 2-state
checkbox item.
.. note:: This method is meaningful only for checkbox-like items.
.. method:: GetAttributes(self)
Returns the item attributes (font, colours, etc...).
:return: An instance of :class:`TreeItemAttr`.
.. method:: GetCheckedImage(self, which=TreeItemIcon_Checked)
Returns the item check image.
:param integer `which`: can be one of the following bits:
================================= ========================
Item State Description
================================= ========================
``TreeItemIcon_Checked`` To get the checkbox checked item image
``TreeItemIcon_NotChecked`` To get the checkbox unchecked item image
``TreeItemIcon_Undetermined`` To get the checkbox undetermined state item image
``TreeItemIcon_Flagged`` To get the radiobutton checked image
``TreeItemIcon_NotFlagged`` To get the radiobutton unchecked image
================================= ========================
:return: An integer index that can be used to retrieve the item check image inside
a :class:`wx.ImageList`.
.. note:: This method is meaningful only for radio & check items.
.. method:: GetChildren(self)
Returns the item's children.
:return: A Python list containing instances of :class:`GenericTreeItem`, representing
this item's children.
.. note:: The returned value is a reference to the list of children
used internally by the tree. It is advised not to change this list
and to make a copy before calling other tree methods as they could
change the contents of the list.
.. method:: GetChildrenCount(self, recursively=True)
Gets the number of children of this item.
:param bool `recursively`: if ``True``, returns the total number of descendants,
otherwise only one level of children is counted.
.. method:: GetCurrentCheckedImage(self)
Returns the current item check image.
:return: An integer index that can be used to retrieve the item check image inside
a :class:`wx.ImageList`.
.. method:: GetCurrentImage(self)
Returns the current item image.
:return: An integer index that can be used to retrieve the item image inside
a :class:`wx.ImageList`.
.. method:: GetData(self)
Returns the data associated to this item.
:return: A Python object representing the item data, or ``None`` if no data
has been assigned to this item.
.. method:: GetHeight(self)
Returns the height of the item, in pixels.
This will be 0 when the item is first created and always 0 for hidden
items. It is updated when the item is calculated.
.. method:: GetImage(self, which=TreeItemIcon_Normal)
Returns the item image for a particular item state.
:param integer `which`: can be one of the following bits:
================================= ========================
Item State Description
================================= ========================
``TreeItemIcon_Normal`` To get the normal item image
``TreeItemIcon_Selected`` To get the selected item image (i.e. the image which is shown when the item is currently selected)
``TreeItemIcon_Expanded`` To get the expanded image (this only makes sense for items which have children - then this image is shown when the item is expanded and the normal image is shown when it is collapsed)
``TreeItemIcon_SelectedExpanded`` To get the selected expanded image (which is shown when an expanded item is currently selected)
================================= ========================
:return: An integer index that can be used to retrieve the item image inside
a :class:`wx.ImageList`.
.. method:: GetLeftImage(self)
Returns the leftmost image associated to this item, i.e. the image on the
leftmost part of the client area of :class:`CustomTreeCtrl`.
:return: An integer index that can be used to retrieve the item leftmost image inside
a :class:`wx.ImageList`.
.. method:: GetParent(self)
Gets the item parent (another instance of :class:`GenericTreeItem` or ``None`` for
root items.
:return: An instance of :class:`GenericTreeItem` or ``None`` for root items.
.. method:: GetSize(self, x, y, theButton)
Returns the item size.
:param integer `x`: the current item's x position;
:param integer `y`: the current item's y position;
:param `theButton`: an instance of the main :class:`CustomTreeCtrl`.
:return: A tuple of (`x`, `y`) dimensions, in pixels, representing the
item's width and height.
.. method:: GetText(self)
Returns the item text.
:return: A string containing the item text.
.. method:: GetType(self)
Returns the item type.
.. seealso:: :meth:`~GenericTreeItem.SetType` and :meth:`~GenericTreeItem.__init__` for a description of valid item types.
.. method:: GetValue(self)
Returns whether the item is checked or not.
.. note:: This is meaningful only for checkbox-like and radiobutton-like items.
.. method:: GetVisited(self)
Returns whether an hypertext item was visited or not.
.. method:: GetWidth(self)
Returns the width of the item's contents, in pixels.
This is the width of the item's text plus the widths of the item's
image, checkbox, and window (if they exist).
A separator's width is the width of the entire client area.
.. method:: GetWindow(self)
Returns the window associated to the item (if any).
:return: An instance of any :class:`wx.Window` derived class, excluding top-level windows.
.. method:: GetWindowEnabled(self)
Returns whether the associated window is enabled or not.
:return: ``True`` if the associated window is enabled, ``False`` if it is disabled.
:raise: `Exception` when the item has no associated window.
.. method:: GetWindowSize(self)
Returns the associated window size.
.. method:: GetX(self)
Returns the `x` position on an item, in logical coordinates.
.. method:: GetY(self)
Returns the `y` position on an item, in logical coordinates.
.. method:: HasChildren(self)
Returns whether the item has children or not.
:return: ``True`` if the item has children, ``False`` otherwise.
.. method:: HasPlus(self)
Returns whether the item has the plus button or not.
:return: ``True`` if the item has a 'plus' mark, ``False`` otherwise.
.. method:: Hide(self, hide)
Hides/shows the item. Internal use only.
:param `hide`: ``True`` to hide the item, ``False`` to show it.
.. note:: Always use :meth:`CustomTreeCtrl.HideItem` instead to update the tree properly.
.. method:: HitTest(self, point, theCtrl, flags=0, level=0)
:meth:`~GenericTreeItem.HitTest` method for an item. Called from the main window :meth:`CustomTreeCtrl.HitTest() `.
:param `point`: the point to test for the hit (an instance of :class:`wx.Point`);
:param `theCtrl`: the main :class:`CustomTreeCtrl` tree;
:param integer `flags`: a bitlist of hit locations;
:param integer `level`: the item's level inside the tree hierarchy.
.. seealso:: :meth:`CustomTreeCtrl.HitTest() ` method for the flags explanation.
:return: A 2-tuple of (item, flags). The item may be ``None``.
.. method:: Insert(self, child, index)
Inserts an item in the item children list for this item.
:param `child`: an instance of :class:`GenericTreeItem`;
:param integer `index`: the index at which we should insert the new child.
.. method:: Is3State(self)
Returns whether or not the checkbox item is a 3-state checkbox.
:return: ``True`` if this checkbox is a 3-state checkbox, ``False`` if it's a
2-state checkbox item.
.. note:: This method is meaningful only for checkbox-like items.
.. method:: IsBold(self)
Returns whether the item font is bold or not.
:return: ``True`` if the item has bold text, ``False`` otherwise.
.. method:: IsChecked(self)
This is just a maybe more readable synonym for :meth:`~GenericTreeItem.GetValue`.
Returns whether the item is checked or not.
.. note:: This is meaningful only for checkbox-like and radiobutton-like items.
.. method:: IsEnabled(self)
Returns whether the item is enabled or not. Hidden items always return False.
:return: ``True`` if the item is enabled, ``False`` if it is disabled.
.. method:: IsExpanded(self)
Returns whether the item is expanded or not. Hidden items always return False.
:return: ``True`` if the item is expanded, ``False`` if it is collapsed.
.. method:: IsHidden(self)
Returns whether the item is hidden or not.
.. method:: IsHyperText(self)
Returns whether the item is hypetext or not.
.. method:: IsItalic(self)
Returns whether the item font is italic or not.
:return: ``True`` if the item has italic text, ``False`` otherwise.
.. method:: IsOk(self)
Returns whether the item is ok or not.
.. note:: This method always returns ``True``, it has been added for
backward compatibility with the wxWidgets C++ implementation.
.. method:: IsSelected(self)
Returns whether the item is selected or not.
:return: ``True`` if the item is selected, ``False`` otherwise.
.. method:: IsSeparator(self)
Returns whether the item is meant to be an horizontal line separator or not.
:return: ``True`` if this item is a separator, ``False`` otherwise.
.. method:: OnSetFocus(self, event)
Handles the ``wx.EVT_SET_FOCUS`` event for the window associated with the item.
:param `event`: a :class:`FocusEvent` event to be processed.
.. method:: OnTreeItemCollapsing(self, event)
Handles the ``wx.EVT_TREE_ITEM_COLLAPSING`` event for the window associated with the item.
:param `event`: a :class:`GenericTreeItem` to be processed.
.. method:: Set3State(self, allow)
Sets whether the item has a 3-state value checkbox assigned to it or not.
:param bool `allow`: ``True`` to set an item as a 3-state checkbox, ``False`` to set it
to a 2-state checkbox.
:return: ``True`` if the change was successful, ``False`` otherwise.
.. note:: This method is meaningful only for checkbox-like items.
.. method:: Set3StateValue(self, state)
Sets the checkbox item to the given `state`.
:param integer `state`: can be one of: ``wx.CHK_UNCHECKED`` (check is off), ``wx.CHK_CHECKED``
(check is on) or ``wx.CHK_UNDETERMINED`` (check is mixed).
:raise: `Exception` when the item is not a 3-state checkbox item.
.. note:: This method raises an exception when the checkbox item is a 2-state checkbox
and setting the state to ``wx.CHK_UNDETERMINED``.
.. note:: This method is meaningful only for checkbox-like items.
.. method:: SetAttributes(self, attr)
Sets the item attributes (font, colours, etc...).
:param `attr`: an instance of :class:`TreeItemAttr`.
.. method:: SetBold(self, bold)
Sets the item font bold.
:parameter bool `bold`: ``True`` to have a bold font item, ``False`` otherwise.
.. note:: Call :meth:`CustomTreeCtrl.SetItemBold` instead to refresh the tree properly.
.. method:: SetData(self, data)
Sets the data associated to this item.
:param object `data`: can be any Python object.
.. method:: SetHasPlus(self, has=True)
Sets whether an item has the 'plus' button.
:param bool `has`: ``True`` to set the 'plus' button on the item, ``False`` otherwise.
.. note:: Call :meth:`CustomTreeCtrl.SetItemHasChildren` instead to refresh the tree properly.
.. method:: SetHeight(self, h)
Sets the item's height. Used internally.
:param integer `h`: an integer specifying the item's height, in pixels.
.. method:: SetHilight(self, set=True)
Sets the item focus/unfocus.
:param bool `set`: ``True`` to set the focus to the item, ``False`` otherwise.
.. note:: Call :meth:`CustomTreeCtrl.SelectItem` instead to update the tree properly and send events.
.. method:: SetHyperText(self, hyper=True)
Sets whether the item is hypertext or not.
:param bool `hyper`: ``True`` to set hypertext behaviour, ``False`` otherwise.
.. note:: Call :meth:`CustomTreeCtrl.SetItemHyperText` instead to refresh the tree properly.
.. method:: SetImage(self, image, which)
Sets the item image.
:param integer `image`: an index within the normal image list specifying the image to use;
:param integer `which`: the image kind.
.. seealso:: :meth:`~GenericTreeItem.GetImage` for a description of the `which` parameter.
.. note:: Call :meth:`CustomTreeCtrl.SetItemImage` instead to refresh the tree properly.
.. method:: SetItalic(self, italic)
Sets the item font italic.
:parameter bool `italic`: ``True`` to have an italic font item, ``False`` otherwise.
.. note:: Call :meth:`CustomTreeCtrl.SetItemItalic` instead to refresh the tree properly.
.. method:: SetLeftImage(self, image)
Sets the item leftmost image, i.e. the image associated to the item on the leftmost
part of the :class:`CustomTreeCtrl` client area.
:param integer `image`: an index within the left image list specifying the image to
use for the item in the leftmost part of the client area.
.. note:: Call :meth:`CustomTreeCtrl.SetItemLeftImage` instead to refresh the tree properly.
.. method:: SetText(self, text)
Sets the item text.
:param string `text`: the new item label.
:raise: `Exception` if the item is a separator.
.. note:: Call :meth:`CustomTreeCtrl.SetItemText` to refresh the tree properly.
.. method:: SetType(self, ct_type)
Sets the item type.
:param integer `ct_type`: may be one of the following integers:
=============== =========================================
`ct_type` Value Description
=============== =========================================
0 A normal item
1 A checkbox-like item
2 A radiobutton-type item
=============== =========================================
.. note:: Regarding radiobutton-type items (with `ct_type` = 2), the following
approach is used:
- All peer-nodes that are radiobuttons will be mutually exclusive. In other words,
only one of a set of radiobuttons that share a common parent can be checked at
once. If a radiobutton node becomes checked, then all of its peer radiobuttons
must be unchecked.
- If a radiobutton node becomes unchecked, then all of its child nodes will become
inactive.
.. note:: Call :meth:`CustomTreeCtrl.SetItemType` instead to refresh the tree properly.
.. method:: SetVisited(self, visited=True)
Sets whether an hypertext item was visited or not.
:param bool `visited`: ``True`` to set a hypertext item as visited, ``False`` otherwise.
.. note:: Call :meth:`CustomTreeCtrl.SetItemVisited` instead to refresh the tree properly.
.. method:: SetWidth(self, w)
Sets the item's width. Used internally.
:param integer `w`: an integer specifying the item's width, in pixels.
.. method:: SetWindow(self, wnd, on_the_right=True)
Sets the window associated to the item. Internal use only.
:param `wnd`: a non-toplevel window to be displayed next to the item, any
subclass of :class:`wx.Window`.
:param bool `on_the_right`: ``True`` positions the window on the right of text, ``False``
on the left of text and overlapping the image. New in wxPython 4.0.4.
:raise: `Exception` if the input `item` is a separator and `wnd` is not ``None``.
.. note:: Always use :meth:`CustomTreeCtrl.SetItemWindow` instead to update the tree properly.
.. method:: SetWindowEnabled(self, enable=True)
Sets whether the associated window is enabled or not.
:param bool `enable`: ``True`` to enable the associated window, ``False`` to disable it.
:raise: `Exception` when the item has no associated window.
.. method:: SetX(self, x)
Sets the `x` position on an item, in logical coordinates.
:param integer `x`: an integer specifying the x position of the item.
.. method:: SetY(self, y)
Sets the `y` position on an item, in logical coordinates.
:param integer `y`: an integer specifying the y position of the item.