.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.TreeCtrl:

==========================================================================================================================================
|phoenix_title|  **wx.TreeCtrl**
==========================================================================================================================================

A tree control presents information as a hierarchy, with items that may be expanded to show further items.          

Items in a tree control are referenced by :ref:`wx.TreeItemId`  handles, which may be tested for validity by calling :meth:`wx.TreeItemId.IsOk` . 

A similar control with a fully native implementation for GTK+ and OS X as well is :ref:`wx.dataview.DataViewTreeCtrl`. 

To intercept events from a tree control, use the event table macros described in :ref:`wx.TreeEvent`. 





.. _TreeCtrl-styles:

|styles| Window Styles
================================

This class supports the following styles: 

  

- ``wx.TR_EDIT_LABELS``: Use this style if you wish the user to be able to edit labels in the tree control.  
- ``wx.TR_NO_BUTTONS``: For convenience to document that no buttons are to be drawn.  
- ``wx.TR_HAS_BUTTONS``: Use this style to show + and - buttons to the left of parent items.  
- ``wx.TR_TWIST_BUTTONS``: Selects alternative style of  +/ ``-``   buttons  and shows rotating ("twisting") arrows instead. Currently this style is only implemented under Microsoft Windows Vista and later Windows versions and is ignored under the other platforms. Notice that under Vista this style results in the same appearance as used by the tree control in Explorer and other built-in programs and so using it may be preferable to the default style.   
- ``wx.TR_NO_LINES``: Use this style to hide vertical level connectors.  
- ``wx.TR_FULL_ROW_HIGHLIGHT``: Use this style to have the background colour and the selection highlight extend over the entire horizontal row of the tree control window. (This flag is ignored under Windows unless you specify  ``TR_NO_LINES``   as well.)   
- ``wx.TR_LINES_AT_ROOT``: Use this style to show lines between root nodes. Only applicable if  ``TR_HIDE_ROOT``   is set and   ``TR_NO_LINES``   is not set.   
- ``wx.TR_HIDE_ROOT``: Use this style to suppress the display of the root node, effectively causing the first-level nodes to appear as a series of root nodes.  
- ``wx.TR_ROW_LINES``: Use this style to draw a contrasting border between displayed rows.  
- ``wx.TR_HAS_VARIABLE_ROW_HEIGHT``: Use this style to cause row heights to be just big enough to fit the content. If not set, all rows use the largest row height. The default is that this flag is unset. Generic only.  
- ``wx.TR_SINGLE``: For convenience to document that only one item may be selected at a time. Selecting another item causes the current selection, if any, to be deselected. This is the default.  
- ``wx.TR_MULTIPLE``: Use this style to allow a range of items to be selected. If a second range is selected, the current range, if any, is deselected.  
- ``wx.TR_DEFAULT_STYLE``: The set of flags that are closest to the defaults for the native control for a particular toolkit.  








.. _TreeCtrl-events:

|events| Events Emitted by this Class
=====================================

Handlers bound for the following event types will receive a :ref:`wx.TreeEvent` parameter.


- EVT_TREE_BEGIN_DRAG: Begin dragging with the left mouse button. If you want to enable left-dragging you need to intercept this event and explicitly call :meth:`wx.TreeEvent.Allow` , as it's vetoed by default. Processes a  ``wxEVT_TREE_BEGIN_DRAG``   event type.   
- EVT_TREE_BEGIN_RDRAG: Begin dragging with the right mouse button. If you want to enable right-dragging you need to intercept this event and explicitly call :meth:`wx.TreeEvent.Allow` , as it's vetoed by default. Processes a  ``wxEVT_TREE_BEGIN_RDRAG``   event type.   
- EVT_TREE_END_DRAG: End dragging with the left or right mouse button. Processes a  ``wxEVT_TREE_END_DRAG``   event type.   
- EVT_TREE_BEGIN_LABEL_EDIT: Begin editing a label. This can be prevented by calling Veto(). Processes a  ``wxEVT_TREE_BEGIN_LABEL_EDIT``   event type.   
- EVT_TREE_END_LABEL_EDIT: Finish editing a label. This can be prevented by calling Veto(). Processes a  ``wxEVT_TREE_END_LABEL_EDIT``   event type.   
- EVT_TREE_DELETE_ITEM: An item was deleted. Processes a  ``wxEVT_TREE_DELETE_ITEM``   event type.   
- EVT_TREE_GET_INFO: Request information from the application. Processes a  ``wxEVT_TREE_GET_INFO``   event type.   
- EVT_TREE_SET_INFO: Information is being supplied. Processes a  ``wxEVT_TREE_SET_INFO``   event type.   
- EVT_TREE_ITEM_ACTIVATED: The item has been activated, i.e. chosen by double clicking it with mouse or from keyboard. Processes a  ``wxEVT_TREE_ITEM_ACTIVATED``   event type.   
- EVT_TREE_ITEM_COLLAPSED: The item has been collapsed. Processes a  ``wxEVT_TREE_ITEM_COLLAPSED``   event type.   
- EVT_TREE_ITEM_COLLAPSING: The item is being collapsed. This can be prevented by calling Veto(). Processes a  ``wxEVT_TREE_ITEM_COLLAPSING``   event type.   
- EVT_TREE_ITEM_EXPANDED: The item has been expanded. Processes a  ``wxEVT_TREE_ITEM_EXPANDED``   event type.   
- EVT_TREE_ITEM_EXPANDING: The item is being expanded. This can be prevented by calling Veto(). Processes a  ``wxEVT_TREE_ITEM_EXPANDING``   event type.   
- EVT_TREE_ITEM_RIGHT_CLICK: The user has clicked the item with the right mouse button. Processes a  ``wxEVT_TREE_ITEM_RIGHT_CLICK``   event type.   
- EVT_TREE_ITEM_MIDDLE_CLICK: The user has clicked the item with the middle mouse button. This is only supported by the generic control. Processes a  ``wxEVT_TREE_ITEM_MIDDLE_CLICK``   event type.   
- EVT_TREE_SEL_CHANGED: Selection has changed. Processes a  ``wxEVT_TREE_SEL_CHANGED``   event type.   
- EVT_TREE_SEL_CHANGING: Selection is changing. This can be prevented by calling Veto(). Processes a  ``wxEVT_TREE_SEL_CHANGING``   event type.   
- EVT_TREE_KEY_DOWN: A key has been pressed. Processes a  ``wxEVT_TREE_KEY_DOWN``   event type.   
- EVT_TREE_ITEM_GETTOOLTIP: The opportunity to set the item tooltip is being given to the application (call :meth:`wx.TreeEvent.SetToolTip` ). Windows only. Processes a  ``wxEVT_TREE_ITEM_GETTOOLTIP``   event type.   
- EVT_TREE_ITEM_MENU: The context menu for the selected item has been requested, either by a right click or by using the menu key. Processes a  ``wxEVT_TREE_ITEM_MENU``   event type.   
- EVT_TREE_STATE_IMAGE_CLICK: The state image has been clicked. Processes a  ``wxEVT_TREE_STATE_IMAGE_CLICK``   event type.   

See also
:ref:`Window Styles <window styles>`. 

**Win32**  **notes:**   

:ref:`wx.TreeCtrl`  class uses the standard common treeview control under Win32 implemented in the system library comctl32.dll. Some versions of this library are known to have bugs with handling the tree control colours: the usual symptom is that the expanded items leave black (or otherwise incorrectly coloured) background behind them, especially for the controls using non-default background colour. The recommended solution is to upgrade the comctl32.dll to a newer version: see `http://www.microsoft.com/downloads/details.aspx?familyid=cb2cf3a2-8025-4e8f-8511-9b476a8d35d2 <http://www.microsoft.com/downloads/details.aspx?familyid=cb2cf3a2-8025-4e8f-8511-9b476a8d35d2>`_ 







         



.. seealso:: :ref:`wx.dataview.DataViewTreeCtrl`, :ref:`wx.TreeEvent`, :ref:`TreeItemData`, :ref:`TreeCtrl Overview <treectrl overview>`, :ref:`wx.ListBox`, :ref:`wx.ListCtrl`, :ref:`wx.ImageList`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>TreeCtrl</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.TreeCtrl_inheritance.png" alt="Inheritance diagram of TreeCtrl" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Control.html" title="wx.Control" alt="" coords="60,237,148,267"/> <area shape="rect" id="node3" href="wx.TreeCtrl.html" title="wx.TreeCtrl" alt="" coords="59,315,149,344"/> <area shape="rect" id="node2" href="wx.Window.html" title="wx.Window" alt="" coords="59,160,148,189"/> <area shape="rect" id="node4" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="48,83,159,112"/> <area shape="rect" id="node5" href="wx.Object.html" title="wx.Object" alt="" coords="5,5,87,35"/> <area shape="rect" id="node6" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="112,5,213,35"/> </map> 
   </p>

|


|appearance| Control Appearance
===============================

|

.. figure:: _static/images/widgets/fullsize/wxmsw/wx.treectrl.png
   :alt: wxMSW
   :figclass: floatleft

   **wxMSW**


.. figure:: _static/images/widgets/fullsize/wxmac/wx.treectrl.png
   :alt: wxMAC
   :figclass: floatright

   **wxMAC**


.. figure:: _static/images/widgets/fullsize/wxgtk/wx.treectrl.png
   :alt: wxGTK
   :figclass: floatcenter

   **wxGTK**


|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.TreeCtrl.__init__`                                                    Default Constructor.
:meth:`~wx.TreeCtrl.AddRoot`                                                     Adds the root node to the tree, returning the new item.
:meth:`~wx.TreeCtrl.AppendItem`                                                  Appends an item to the end of the branch identified by `parent`, return a new item id.
:meth:`~wx.TreeCtrl.AssignImageList`                                             Sets the normal image list.
:meth:`~wx.TreeCtrl.AssignStateImageList`                                        Sets the state image list.
:meth:`~wx.TreeCtrl.ClearFocusedItem`                                            Clears the currently focused item.
:meth:`~wx.TreeCtrl.Collapse`                                                    Collapses the given item.
:meth:`~wx.TreeCtrl.CollapseAll`                                                 Collapses the root item.
:meth:`~wx.TreeCtrl.CollapseAllChildren`                                         Collapses this item and all of its children, recursively.
:meth:`~wx.TreeCtrl.CollapseAndReset`                                            Collapses the given item and removes all children.
:meth:`~wx.TreeCtrl.Create`                                                      Creates the tree control.
:meth:`~wx.TreeCtrl.Delete`                                                      Deletes the specified item.
:meth:`~wx.TreeCtrl.DeleteAllItems`                                              Deletes all items in the control.
:meth:`~wx.TreeCtrl.DeleteChildren`                                              Deletes all children of the given item (but not the item itself).
:meth:`~wx.TreeCtrl.EditLabel`                                                   Starts editing the label of the given `item`.
:meth:`~wx.TreeCtrl.EnableBellOnNoMatch`                                         Enable or disable a beep if there is no match for the currently entered text when searching for the item from keyboard.
:meth:`~wx.TreeCtrl.EndEditLabel`                                                Ends label editing.
:meth:`~wx.TreeCtrl.EnsureVisible`                                               Scrolls and/or expands items to ensure that the given item is visible.
:meth:`~wx.TreeCtrl.Expand`                                                      Expands the given item.
:meth:`~wx.TreeCtrl.ExpandAll`                                                   Expands all items in the tree.
:meth:`~wx.TreeCtrl.ExpandAllChildren`                                           Expands the given item and all its children recursively.
:meth:`~wx.TreeCtrl.GetBoundingRect`                                             Returns the rectangle bounding the item. If textOnly is ``True``,
:meth:`~wx.TreeCtrl.GetChildrenCount`                                            Returns the number of items in the branch.
:meth:`~wx.TreeCtrl.GetClassDefaultAttributes`                                   
:meth:`~wx.TreeCtrl.GetCount`                                                    Returns the number of items in the control.
:meth:`~wx.TreeCtrl.GetEditControl`                                              Returns the edit control being currently used to edit a label.
:meth:`~wx.TreeCtrl.GetFirstChild`                                               Returns the first child; call :meth:`~TreeCtrl.GetNextChild`   for the next child.
:meth:`~wx.TreeCtrl.GetFirstVisibleItem`                                         Returns the first visible item.
:meth:`~wx.TreeCtrl.GetFocusedItem`                                              Returns the item last clicked or otherwise selected.
:meth:`~wx.TreeCtrl.GetImageList`                                                Returns the normal image list.
:meth:`~wx.TreeCtrl.GetIndent`                                                   Returns the current tree control indentation.
:meth:`~wx.TreeCtrl.GetItemBackgroundColour`                                     Returns the background colour of the item.
:meth:`~wx.TreeCtrl.GetItemData`                                                 Returns the tree item data associated with the item.
:meth:`~wx.TreeCtrl.GetItemFont`                                                 Returns the font of the item label.
:meth:`~wx.TreeCtrl.GetItemImage`                                                Gets the specified item image.
:meth:`~wx.TreeCtrl.GetItemParent`                                               Returns the item's parent.
:meth:`~wx.TreeCtrl.GetItemState`                                                Gets the specified item state.
:meth:`~wx.TreeCtrl.GetItemText`                                                 Returns the item label.
:meth:`~wx.TreeCtrl.GetItemTextColour`                                           Returns the colour of the item label.
:meth:`~wx.TreeCtrl.GetLastChild`                                                Returns the last child of the item (or an invalid tree item if this item has no children).
:meth:`~wx.TreeCtrl.GetNextChild`                                                Returns the next child; call :meth:`~TreeCtrl.GetFirstChild`   for the first child.
:meth:`~wx.TreeCtrl.GetNextSibling`                                              Returns the next sibling of the specified item; call :meth:`~TreeCtrl.GetPrevSibling`   for the previous sibling.
:meth:`~wx.TreeCtrl.GetNextVisible`                                              Returns the next visible item or an invalid item if this item is the last visible one.
:meth:`~wx.TreeCtrl.GetPrevSibling`                                              Returns the previous sibling of the specified item; call :meth:`~TreeCtrl.GetNextSibling`   for the next sibling.
:meth:`~wx.TreeCtrl.GetPrevVisible`                                              Returns the previous visible item or an invalid item if this item is the first visible one.
:meth:`~wx.TreeCtrl.GetQuickBestSize`                                            Returns ``True`` if the control will use a quick calculation for the best size, looking only at the first and last items.
:meth:`~wx.TreeCtrl.GetRootItem`                                                 Returns the root item for the tree control.
:meth:`~wx.TreeCtrl.GetSelection`                                                Returns the selection, or an invalid item if there is no selection.
:meth:`~wx.TreeCtrl.GetSelections`                                               Returns a list of currently selected items in the tree.  This function can be called only if the control has the wx.``wx.TR_MULTIPLE`` style.
:meth:`~wx.TreeCtrl.GetStateImageList`                                           Returns the state image list (from which application-defined state images are taken).
:meth:`~wx.TreeCtrl.HitTest`                                                     Calculates which (if any) item is under the given `point`, returning the tree item id at this point plus extra information `flags`.
:meth:`~wx.TreeCtrl.InsertItem`                                                  Inserts an item after a given one (`previous`).
:meth:`~wx.TreeCtrl.IsBold`                                                      Returns ``True`` if the given item is in bold state.
:meth:`~wx.TreeCtrl.IsEmpty`                                                     Returns ``True`` if the control is empty (i.e. has no items, even no root one).
:meth:`~wx.TreeCtrl.IsExpanded`                                                  Returns ``True`` if the item is expanded (only makes sense if it has children).
:meth:`~wx.TreeCtrl.IsSelected`                                                  Returns ``True`` if the item is selected.
:meth:`~wx.TreeCtrl.IsVisible`                                                   Returns ``True`` if the item is visible on the screen.
:meth:`~wx.TreeCtrl.ItemHasChildren`                                             Returns ``True`` if the item has children.
:meth:`~wx.TreeCtrl.OnCompareItems`                                              Override this function in the derived class to change the sort order of the items in the tree control.
:meth:`~wx.TreeCtrl.PrependItem`                                                 Appends an item as the first child of `parent`, return a new item id.
:meth:`~wx.TreeCtrl.ScrollTo`                                                    Scrolls the specified item into view.
:meth:`~wx.TreeCtrl.SelectChildren`                                              Select all the immediate children of the given parent.
:meth:`~wx.TreeCtrl.SelectItem`                                                  Selects the given item.
:meth:`~wx.TreeCtrl.SetFocusedItem`                                              Sets the currently focused item.
:meth:`~wx.TreeCtrl.SetImageList`                                                Sets the normal image list.
:meth:`~wx.TreeCtrl.SetIndent`                                                   Sets the indentation for the tree control.
:meth:`~wx.TreeCtrl.SetItemBackgroundColour`                                     Sets the colour of the item's background.
:meth:`~wx.TreeCtrl.SetItemBold`                                                 Makes item appear in bold font if `bold`  parameter is ``True`` or resets it to the normal state.
:meth:`~wx.TreeCtrl.SetItemData`                                                 Sets the item client data.
:meth:`~wx.TreeCtrl.SetItemDropHighlight`                                        Gives the item the visual feedback for Drag'n'Drop actions, which is useful if something is dragged from the outside onto the tree control (as opposed to a DnD operation within the tree control, which already is implemented internally).
:meth:`~wx.TreeCtrl.SetItemFont`                                                 Sets the item's font.
:meth:`~wx.TreeCtrl.SetItemHasChildren`                                          Force appearance of the button next to the item.
:meth:`~wx.TreeCtrl.SetItemImage`                                                Sets the specified item's image.
:meth:`~wx.TreeCtrl.SetItemState`                                                Sets the specified item state.
:meth:`~wx.TreeCtrl.SetItemText`                                                 Sets the item label.
:meth:`~wx.TreeCtrl.SetItemTextColour`                                           Sets the colour of the item's text.
:meth:`~wx.TreeCtrl.SetQuickBestSize`                                            If ``True`` is passed, specifies that the control will use a quick calculation for the best size, looking only at the first and last items.
:meth:`~wx.TreeCtrl.SetStateImageList`                                           Sets the state image list (from which application-defined state images are taken).
:meth:`~wx.TreeCtrl.SetWindowStyle`                                              Sets the mode flags associated with the display of the tree control.
:meth:`~wx.TreeCtrl.SortChildren`                                                Sorts the children of the given item using :meth:`~TreeCtrl.OnCompareItems` .
:meth:`~wx.TreeCtrl.Toggle`                                                      Toggles the given item between collapsed and expanded states.
:meth:`~wx.TreeCtrl.ToggleItemSelection`                                         Toggles the given item between selected and unselected states.
:meth:`~wx.TreeCtrl.Unselect`                                                    Removes the selection from the currently selected item (if any).
:meth:`~wx.TreeCtrl.UnselectAll`                                                 This function either behaves the same as :meth:`~TreeCtrl.Unselect`   if the control doesn't have  ``TR_MULTIPLE``   style, or removes the selection from all items if it does have this style.
:meth:`~wx.TreeCtrl.UnselectItem`                                                Unselects the given item.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.TreeCtrl.BoundingRect`                                                See :meth:`~wx.TreeCtrl.GetBoundingRect`
:attr:`~wx.TreeCtrl.Count`                                                       See :meth:`~wx.TreeCtrl.GetCount`
:attr:`~wx.TreeCtrl.EditControl`                                                 See :meth:`~wx.TreeCtrl.GetEditControl`
:attr:`~wx.TreeCtrl.FirstVisibleItem`                                            See :meth:`~wx.TreeCtrl.GetFirstVisibleItem`
:attr:`~wx.TreeCtrl.FocusedItem`                                                 See :meth:`~wx.TreeCtrl.GetFocusedItem` and :meth:`~wx.TreeCtrl.SetFocusedItem`
:attr:`~wx.TreeCtrl.ImageList`                                                   See :meth:`~wx.TreeCtrl.GetImageList` and :meth:`~wx.TreeCtrl.SetImageList`
:attr:`~wx.TreeCtrl.Indent`                                                      See :meth:`~wx.TreeCtrl.GetIndent` and :meth:`~wx.TreeCtrl.SetIndent`
:attr:`~wx.TreeCtrl.QuickBestSize`                                               See :meth:`~wx.TreeCtrl.GetQuickBestSize` and :meth:`~wx.TreeCtrl.SetQuickBestSize`
:attr:`~wx.TreeCtrl.RootItem`                                                    See :meth:`~wx.TreeCtrl.GetRootItem`
:attr:`~wx.TreeCtrl.Selection`                                                   See :meth:`~wx.TreeCtrl.GetSelection`
:attr:`~wx.TreeCtrl.Selections`                                                  See :meth:`~wx.TreeCtrl.GetSelections`
:attr:`~wx.TreeCtrl.StateImageList`                                              See :meth:`~wx.TreeCtrl.GetStateImageList` and :meth:`~wx.TreeCtrl.SetStateImageList`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.TreeCtrl(Control)

   **Possible constructors**::

       TreeCtrl()
       
       TreeCtrl(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize,
                style=TR_DEFAULT_STYLE, validator=DefaultValidator,
                name=TreeCtrlNameStr)
       
   
   A tree control presents information as a hierarchy, with items that
   may be expanded to show further items.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **__init__** `(self)`
      
      Default Constructor.                   
      
      
      
      
      **~~~**

      
      **__init__** `(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=TR_DEFAULT_STYLE, validator=DefaultValidator, name=TreeCtrlNameStr)`
      
      Constructor, creating and showing a tree control.                  
      
      
      
      
      :param `parent`: Parent window. Must not be ``None``.   
      :type `parent`: wx.Window
      :param `id`: Window identifier. The value  ``ID_ANY``   indicates a default value.    
      :type `id`: wx.WindowID
      :param `pos`: Window position. If :ref:`wx.DefaultPosition`  is specified then a default position is chosen.   
      :type `pos`: wx.Point
      :param `size`: Window size. If :ref:`wx.DefaultSize`  is specified then the window is sized appropriately.   
      :type `size`: wx.Size
      :param `style`: Window style. See :ref:`wx.TreeCtrl`.   
      :type `style`: long
      :param `validator`: Window validator.   
      :type `validator`: wx.Validator
      :param `name`: Window name.  
      :type `name`: string
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
                        
      
      
      
      .. seealso:: :meth:`Create` , :ref:`wx.Validator`    
      
      
      
      
      
      
      
      **~~~**






   .. method:: AddRoot(self, text, image=-1, selImage=-1, data=None)

      Adds the root node to the tree, returning the new item.                  

      The `image`  and `selImage`  parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If `image`  -1 and `selImage`  is -1, the same image is used for both selected and unselected items.                  


      :param `text`: 
      :type `text`: string
      :param `image`: 
      :type `image`: int
      :param `selImage`: 
      :type `selImage`: int
      :param `data`: 
      :type `data`: TreeItemData




      :rtype: :ref:`wx.TreeItemId`








   .. method:: AppendItem(self, parent, text, image=-1, selImage=-1, data=None)

      Appends an item to the end of the branch identified by `parent`, return a new item id.                  

      The `image`  and `selImage`  parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If `image`  > -1 and `selImage`  is -1, the same image is used for both selected and unselected items.                  


      :param `parent`: 
      :type `parent`: wx.TreeItemId
      :param `text`: 
      :type `text`: string
      :param `image`: 
      :type `image`: int
      :param `selImage`: 
      :type `selImage`: int
      :param `data`: 
      :type `data`: TreeItemData




      :rtype: :ref:`wx.TreeItemId`








   .. method:: AssignImageList(self, imageList)

      Sets the normal image list.                  

      The image list assigned with this method will be automatically deleted by :ref:`wx.TreeCtrl`  as appropriate (i.e. it takes ownership of the list). 

                


      :param `imageList`: 
      :type `imageList`: wx.ImageList






      .. seealso:: :meth:`SetImageList` .   








   .. method:: AssignStateImageList(self, imageList)

      Sets the state image list.                  

      Image list assigned with this method will be automatically deleted by :ref:`wx.TreeCtrl`  as appropriate (i.e. it takes ownership of the list). 

                


      :param `imageList`: 
      :type `imageList`: wx.ImageList






      .. seealso:: :meth:`SetStateImageList` .   








   .. method:: ClearFocusedItem(self)

      Clears the currently focused item.                  

                 



      .. versionadded:: 2.9.1 
     








   .. method:: Collapse(self, item)

      Collapses the given item.                  


      :param `item`: 
      :type `item`: wx.TreeItemId







   .. method:: CollapseAll(self)

      Collapses the root item.                  

                 



      .. seealso:: :meth:`ExpandAll`     








   .. method:: CollapseAllChildren(self, item)

      Collapses this item and all of its children, recursively.                  

                


      :param `item`: 
      :type `item`: wx.TreeItemId






      .. seealso:: :meth:`ExpandAllChildren`     








   .. method:: CollapseAndReset(self, item)

      Collapses the given item and removes all children.                  


      :param `item`: 
      :type `item`: wx.TreeItemId







   .. method:: Create(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=TR_DEFAULT_STYLE, validator=DefaultValidator, name=TreeCtrlNameStr)

      Creates the tree control.                  

      See :meth:`TreeCtrl.__init__`   for further details.                  


      :param `parent`: 
      :type `parent`: wx.Window
      :param `id`: 
      :type `id`: wx.WindowID
      :param `pos`: 
      :type `pos`: wx.Point
      :param `size`: 
      :type `size`: wx.Size
      :param `style`: 
      :type `style`: long
      :param `validator`: 
      :type `validator`: wx.Validator
      :param `name`: 
      :type `name`: string




      :rtype: `bool`








   .. method:: Delete(self, item)

      Deletes the specified item.                  

      A  ``EVT_TREE_DELETE_ITEM``   event will be generated. 

      This function may cause a subsequent call to :meth:`GetNextChild`   to fail.                  


      :param `item`: 
      :type `item`: wx.TreeItemId







   .. method:: DeleteAllItems(self)

      Deletes all items in the control.                  

      Note that this may not generate  ``EVT_TREE_DELETE_ITEM``   events under some Windows versions although normally such event is generated for each removed item.                    





   .. method:: DeleteChildren(self, item)

      Deletes all children of the given item (but not the item itself).                  

      Note that this will **not**  generate any events unlike :meth:`Delete`   method. 

      If you have called :meth:`SetItemHasChildren` , you may need to call it again since :meth:`DeleteChildren`   does not automatically clear the setting.                  


      :param `item`: 
      :type `item`: wx.TreeItemId







   .. method:: EditLabel(self, item)

      Starts editing the label of the given `item`.                  

      This function generates a  ``EVT_TREE_BEGIN_LABEL_EDIT``   event which can be vetoed so that no text control will appear for in-place editing. 

      If the user changed the label (i.e. s/he does not press ``ESC`` or leave the text control without changes, a  ``EVT_TREE_END_LABEL_EDIT``   event will be sent which can be vetoed as well. 

                


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: :ref:`wx.TextCtrl`







      .. seealso:: :meth:`EndEditLabel` , :ref:`wx.TreeEvent`    








   .. method:: EnableBellOnNoMatch(self, on=True)

      Enable or disable a beep if there is no match for the currently entered text when searching for the item from keyboard.                  

      The default is to not beep in this case except in wxMSW where the beep is always generated by the native control and cannot be disabled, i.e. calls to this function do nothing there. 

                


      :param `on`: 
      :type `on`: bool






      .. versionadded:: 2.9.5 
     








   .. method:: EndEditLabel(self, item, discardChanges=False)

      Ends label editing.                  

      If `cancelEdit`  is ``True``, the edit will be cancelled. 

                


      :param `item`: 
      :type `item`: wx.TreeItemId
      :param `discardChanges`: 
      :type `discardChanges`: bool






      .. note:: 

         This function is currently supported under Windows only.  







      .. seealso:: :meth:`EditLabel`     








   .. method:: EnsureVisible(self, item)

      Scrolls and/or expands items to ensure that the given item is visible.                  


      :param `item`: 
      :type `item`: wx.TreeItemId







   .. method:: Expand(self, item)

      Expands the given item.                  


      :param `item`: 
      :type `item`: wx.TreeItemId







   .. method:: ExpandAll(self)

      Expands all items in the tree.                   





   .. method:: ExpandAllChildren(self, item)

      Expands the given item and all its children recursively.                  


      :param `item`: 
      :type `item`: wx.TreeItemId







   .. method:: GetBoundingRect(self, item, textOnly=False)

                      Returns the rectangle bounding the item. If textOnly is ``True``,
                      only the rectangle around the item's label will be returned, otherwise
                      the item's image is also taken into account. The return value may be None
                      if the rectangle was not successfully retrieved, such as if the item is
                      currently not visible.
                 

      :rtype: :ref:`PyObject`








   .. method:: GetChildrenCount(self, item, recursively=True)

      Returns the number of items in the branch.                  

      If `recursively`  is ``True``, returns the total number of descendants, otherwise only one level of children is counted.                  


      :param `item`: 
      :type `item`: wx.TreeItemId
      :param `recursively`: 
      :type `recursively`: bool




      :rtype: `int`








   .. staticmethod:: GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)




      :param `variant`: 
      :type `variant`: wx.WindowVariant




      :rtype: :ref:`wx.VisualAttributes`








   .. method:: GetCount(self)

      Returns the number of items in the control.                  

      :rtype: `int`








   .. method:: GetEditControl(self)

      Returns the edit control being currently used to edit a label.                  

      Returns ``None`` if no label is being edited. 

                

      :rtype: :ref:`wx.TextCtrl`







      .. note:: 

         This is currently only implemented for wxMSW.   








   .. method:: GetFirstChild(self, item)

      Returns the first child; call :meth:`GetNextChild`   for the next child.                  

      For this enumeration function you must pass in a 'cookie' parameter which is opaque for the application but is necessary for the library to make these functions reentrant (i.e. allow more than one enumeration on one and the same object simultaneously). The cookie passed to :meth:`GetFirstChild`   and :meth:`GetNextChild`   should be the same variable. 

      Returns an invalid tree item (i.e. :meth:`wx.TreeItemId.IsOk`   returns ``False``) if there are no further children. 

      




   .. method:: GetFirstVisibleItem(self)

      Returns the first visible item.                  

      :rtype: :ref:`wx.TreeItemId`








   .. method:: GetFocusedItem(self)

      Returns the item last clicked or otherwise selected.                  

      Unlike :meth:`GetSelection` , it can be used whether or not the control has the  ``TR_MULTIPLE``   style. 

                

      :rtype: :ref:`wx.TreeItemId`







      .. versionadded:: 2.9.1 
     








   .. method:: GetImageList(self)

      Returns the normal image list.                  

      :rtype: :ref:`wx.ImageList`








   .. method:: GetIndent(self)

      Returns the current tree control indentation.                  

      :rtype: `int`








   .. method:: GetItemBackgroundColour(self, item)

      Returns the background colour of the item.                  


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: :ref:`wx.Colour`








   .. method:: GetItemData(self, item)

      Returns the tree item data associated with the item.                  

      




   .. method:: GetItemFont(self, item)

      Returns the font of the item label.                  

      If the font hadn't been explicitly set for the specified `item`  with :meth:`SetItemFont` , returns an invalid :ref:`wx.NullFont`  font. :meth:`GetFont`   can be used to retrieve the global tree control font used for the items without any specific font.                  


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: :ref:`wx.Font`








   .. method:: GetItemImage(self, item, which=TreeItemIcon_Normal)

      Gets the specified item image.                  

      The value of `which`  may be:

      - :ref:`wx.TreeItemIcon_Normal`: to get the normal item image. 
      - :ref:`wx.TreeItemIcon_Selected`: to get the selected item image (i.e. the image which is shown when the item is currently selected). 
      - :ref:`wx.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). 
      - :ref:`wx.TreeItemIcon_SelectedExpanded`: to get the selected expanded image (which is shown when an expanded item is currently selected).  


                 


      :param `item`: 
      :type `item`: wx.TreeItemId
      :param `which`: 
      :type `which`: wx.TreeItemIcon




      :rtype: `int`








   .. method:: GetItemParent(self, item)

      Returns the item's parent.                  


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: :ref:`wx.TreeItemId`








   .. method:: GetItemState(self, item)

      Gets the specified item state.                  


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: `int`








   .. method:: GetItemText(self, item)

      Returns the item label.                  


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: `string`








   .. method:: GetItemTextColour(self, item)

      Returns the colour of the item label.                  


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: :ref:`wx.Colour`








   .. method:: GetLastChild(self, item)

      Returns the last child of the item (or an invalid tree item if this item has no children).                  

                


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: :ref:`wx.TreeItemId`







      .. seealso:: :meth:`GetFirstChild` , :meth:`GetNextSibling` , :meth:`GetLastChild`     








   .. method:: GetNextChild(self, item, cookie)

      Returns the next child; call :meth:`GetFirstChild`   for the first child.                  

      For this enumeration function you must pass in a 'cookie' parameter which is opaque for the application but is necessary for the library to make these functions reentrant (i.e. allow more than one enumeration on one and the same object simultaneously). The cookie passed to :meth:`GetFirstChild`   and :meth:`GetNextChild`   should be the same. 

      Returns an invalid tree item if there are no further children. 

      




   .. method:: GetNextSibling(self, item)

      Returns the next sibling of the specified item; call :meth:`GetPrevSibling`   for the previous sibling.                  

      Returns an invalid tree item if there are no further siblings. 

                


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: :ref:`wx.TreeItemId`







      .. seealso:: :meth:`GetPrevSibling`     








   .. method:: GetNextVisible(self, item)

      Returns the next visible item or an invalid item if this item is the last visible one.                  

                


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: :ref:`wx.TreeItemId`







      .. note:: 

         The `item`  itself must be visible.   








   .. method:: GetPrevSibling(self, item)

      Returns the previous sibling of the specified item; call :meth:`GetNextSibling`   for the next sibling.                  

      Returns an invalid tree item if there are no further children. 

                


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: :ref:`wx.TreeItemId`







      .. seealso:: :meth:`GetNextSibling`     








   .. method:: GetPrevVisible(self, item)

      Returns the previous visible item or an invalid item if this item is the first visible one.                  

                


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: :ref:`wx.TreeItemId`







      .. note:: 

         The `item`  itself must be visible.   








   .. method:: GetQuickBestSize(self)

      Returns ``True`` if the control will use a quick calculation for the best size, looking only at the first and last items.                  

      The default is ``False``. 

                

      :rtype: `bool`







      .. seealso:: :meth:`SetQuickBestSize`     








   .. method:: GetRootItem(self)

      Returns the root item for the tree control.                  

      :rtype: :ref:`wx.TreeItemId`








   .. method:: GetSelection(self)

      Returns the selection, or an invalid item if there is no selection.                  

      This function only works with the controls without  ``TR_MULTIPLE``   style, use  :meth:`GetSelections`   for the controls which do have this style or, if a single item is wanted, use :meth:`GetFocusedItem` .                  

      :rtype: :ref:`wx.TreeItemId`








   .. method:: GetSelections(self)

      Returns a list of currently selected items in the tree.  This function can be called only if the control has the wx.``wx.TR_MULTIPLE`` style. 

      :rtype: :ref:`PyObject`








   .. method:: GetStateImageList(self)

      Returns the state image list (from which application-defined state images are taken).                  

      :rtype: :ref:`wx.ImageList`








   .. method:: HitTest(self, point, flags)

      Calculates which (if any) item is under the given `point`, returning the tree item id at this point plus extra information `flags`.                  

      `flags`  is a bitlist of the following: 



      -  ``TREE_HITTEST_ABOVE:``   Above the client area. 
      -  ``TREE_HITTEST_BELOW:``   Below the client area. 
      -  ``TREE_HITTEST_NOWHERE:``   In the client area but below the last item. 
      -  ``TREE_HITTEST_ONITEMBUTTON:``   On the button associated with an item. 
      -  ``TREE_HITTEST_ONITEMICON:``   On the bitmap associated with an item. 
      -  ``TREE_HITTEST_ONITEMINDENT:``   In the indentation associated with an item. 
      -  ``TREE_HITTEST_ONITEMLABEL:``   On the label (string) associated with an item. 
      -  ``TREE_HITTEST_ONITEMRIGHT:``   In the area to the right of an item. 
      -  ``TREE_HITTEST_ONITEMSTATEICON:``   On the state icon for a tree view item that is in a user-defined state. 
      -  ``TREE_HITTEST_TOLEFT:``   To the right of the client area. 
      -  ``TREE_HITTEST_TORIGHT:``   To the left of the client area. 




      




   .. method:: InsertItem(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **InsertItem** `(self, parent, previous, text, image=-1, selImage=-1, data=None)`
      
      Inserts an item after a given one (`previous`).                  
      
      The `image`  and `selImage`  parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If `image`  -1 and `selImage`  is -1, the same image is used for both selected and unselected items.                  
      
      
      :param `parent`: 
      :type `parent`: wx.TreeItemId
      :param `previous`: 
      :type `previous`: wx.TreeItemId
      :param `text`: 
      :type `text`: string
      :param `image`: 
      :type `image`: int
      :param `selImage`: 
      :type `selImage`: int
      :param `data`: 
      :type `data`: TreeItemData
      
      
      
      
      :rtype: :ref:`wx.TreeItemId`
      
      
      
      
      
      
      
      **~~~**

      
      **InsertItem** `(self, parent, pos, text, image=-1, selImage=-1, data=None)`
      
      Inserts an item before one identified by its position (`pos`).                  
      
      `pos`  must be less than or equal to the number of children. 
      
      The `image`  and `selImage`  parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If `image`  -1 and `selImage`  is -1, the same image is used for both selected and unselected items.                  
      
      
      :param `parent`: 
      :type `parent`: wx.TreeItemId
      :param `pos`: 
      :type `pos`: int
      :param `text`: 
      :type `text`: string
      :param `image`: 
      :type `image`: int
      :param `selImage`: 
      :type `selImage`: int
      :param `data`: 
      :type `data`: TreeItemData
      
      
      
      
      :rtype: :ref:`wx.TreeItemId`
      
      
      
      
      
      
      
      **~~~**






   .. method:: IsBold(self, item)

      Returns ``True`` if the given item is in bold state.                  

                


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: `bool`







      .. seealso:: :meth:`SetItemBold`     








   .. method:: IsEmpty(self)

      Returns ``True`` if the control is empty (i.e. has no items, even no root one).                  

      :rtype: `bool`








   .. method:: IsExpanded(self, item)

      Returns ``True`` if the item is expanded (only makes sense if it has children).                  


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: `bool`








   .. method:: IsSelected(self, item)

      Returns ``True`` if the item is selected.                  


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: `bool`








   .. method:: IsVisible(self, item)

      Returns ``True`` if the item is visible on the screen.                  


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: `bool`








   .. method:: ItemHasChildren(self, item)

      Returns ``True`` if the item has children.                  


      :param `item`: 
      :type `item`: wx.TreeItemId




      :rtype: `bool`








   .. method:: OnCompareItems(self, item1, item2)

      Override this function in the derived class to change the sort order of the items in the tree control.                  

      The function should return a negative, zero or positive value if the first item is less than, equal to or greater than the second one. 

      Please note that you **must**  use ``RTTI`` macros ``DECLARE_DYNAMIC_CLASS``  and ``IMPLEMENT_DYNAMIC_CLASS``  if you override this function because otherwise the base class considers that it is not overridden and uses the default comparison, i.e. sorts the items alphabetically, which allows it optimize away the calls to the virtual function completely. 

                


      :param `item1`: 
      :type `item1`: wx.TreeItemId
      :param `item2`: 
      :type `item2`: wx.TreeItemId




      :rtype: `int`







      .. seealso:: :meth:`SortChildren`     








   .. method:: PrependItem(self, parent, text, image=-1, selImage=-1, data=None)

      Appends an item as the first child of `parent`, return a new item id.                  

      The `image`  and `selImage`  parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If `image`  -1 and `selImage`  is -1, the same image is used for both selected and unselected items.                  


      :param `parent`: 
      :type `parent`: wx.TreeItemId
      :param `text`: 
      :type `text`: string
      :param `image`: 
      :type `image`: int
      :param `selImage`: 
      :type `selImage`: int
      :param `data`: 
      :type `data`: TreeItemData




      :rtype: :ref:`wx.TreeItemId`








   .. method:: ScrollTo(self, item)

      Scrolls the specified item into view.                  


      :param `item`: 
      :type `item`: wx.TreeItemId







   .. method:: SelectChildren(self, parent)

      Select all the immediate children of the given parent.                  

      This function can be used with multiselection controls only. 

                


      :param `parent`: 
      :type `parent`: wx.TreeItemId






      .. versionadded:: 2.9.1 
     








   .. method:: SelectItem(self, item, select=True)

      Selects the given item.                  

      In multiple selection controls, can be also used to deselect a currently selected item if the value of `select`  is ``False``. 

      Notice that calling this method will generate  ``wxEVT_TREE_SEL_CHANGING``   and   ``wxEVT_TREE_SEL_CHANGED``   events and that the change could be vetoed by the former event handler.                   


      :param `item`: 
      :type `item`: wx.TreeItemId
      :param `select`: 
      :type `select`: bool







   .. method:: SetFocusedItem(self, item)

      Sets the currently focused item.                  




      :param `item`: The item to make the current one. It must be valid.   
      :type `item`: wx.TreeItemId




                  



      .. versionadded:: 2.9.1 
     








   .. method:: SetImageList(self, imageList)

      Sets the normal image list.                  

      The image list assigned with this method will **not**  be deleted by :ref:`wx.TreeCtrl`'s destructor, you must delete it yourself. 

                


      :param `imageList`: 
      :type `imageList`: wx.ImageList






      .. seealso:: :meth:`AssignImageList` .   








   .. method:: SetIndent(self, indent)

      Sets the indentation for the tree control.                  


      :param `indent`: 
      :type `indent`: int







   .. method:: SetItemBackgroundColour(self, item, col)

      Sets the colour of the item's background.                  


      :param `item`: 
      :type `item`: wx.TreeItemId
      :param `col`: 
      :type `col`: wx.Colour







   .. method:: SetItemBold(self, item, bold=True)

      Makes item appear in bold font if `bold`  parameter is ``True`` or resets it to the normal state.                  

                


      :param `item`: 
      :type `item`: wx.TreeItemId
      :param `bold`: 
      :type `bold`: bool






      .. seealso:: :meth:`IsBold`     








   .. method:: SetItemData(self, item, data)

      Sets the item client data.                  

      Notice that the client data previously associated with the `item`  (if any) is `not`  freed by this function and so calling this function multiple times for the same item will result in memory leaks unless you delete the old item data pointer yourself. 

      




   .. method:: SetItemDropHighlight(self, item, highlight=True)

      Gives the item the visual feedback for Drag'n'Drop actions, which is useful if something is dragged from the outside onto the tree control (as opposed to a DnD operation within the tree control, which already is implemented internally).                  


      :param `item`: 
      :type `item`: wx.TreeItemId
      :param `highlight`: 
      :type `highlight`: bool







   .. method:: SetItemFont(self, item, font)

      Sets the item's font.                  

      All items in the tree should have the same height to avoid text clipping, so the fonts height should be the same for all of them, although font attributes may vary. 

                


      :param `item`: 
      :type `item`: wx.TreeItemId
      :param `font`: 
      :type `font`: wx.Font






      .. seealso:: :meth:`SetItemBold`     








   .. method:: SetItemHasChildren(self, item, hasChildren=True)

      Force appearance of the button next to the item.                  

      This is useful to allow the user to expand the items which don't have any children now, but instead adding them only when needed, thus minimizing memory usage and loading time.                  


      :param `item`: 
      :type `item`: wx.TreeItemId
      :param `hasChildren`: 
      :type `hasChildren`: bool







   .. method:: SetItemImage(self, item, image, which=TreeItemIcon_Normal)

      Sets the specified item's image.                  

      See :meth:`GetItemImage`   for the description of the `which`  parameter.                  


      :param `item`: 
      :type `item`: wx.TreeItemId
      :param `image`: 
      :type `image`: int
      :param `which`: 
      :type `which`: wx.TreeItemIcon







   .. method:: SetItemState(self, item, state)

      Sets the specified item state.                  

      The value of `state`  may be an index into the state image list, or one of the special values:

      -  ``TREE_ITEMSTATE_NONE:``   to disable the item state (the state image will be not displayed). 
      -  ``TREE_ITEMSTATE_NEXT:``   to set the next item state. 
      -  ``TREE_ITEMSTATE_PREV:``   to set the previous item state.   


                 


      :param `item`: 
      :type `item`: wx.TreeItemId
      :param `state`: 
      :type `state`: int







   .. method:: SetItemText(self, item, text)

      Sets the item label.                  


      :param `item`: 
      :type `item`: wx.TreeItemId
      :param `text`: 
      :type `text`: string







   .. method:: SetItemTextColour(self, item, col)

      Sets the colour of the item's text.                  


      :param `item`: 
      :type `item`: wx.TreeItemId
      :param `col`: 
      :type `col`: wx.Colour







   .. method:: SetQuickBestSize(self, quickBestSize)

      If ``True`` is passed, specifies that the control will use a quick calculation for the best size, looking only at the first and last items.                  

      Otherwise, it will look at all items. The default is ``False``. 

                


      :param `quickBestSize`: 
      :type `quickBestSize`: bool






      .. seealso:: :meth:`GetQuickBestSize`     








   .. method:: SetStateImageList(self, imageList)

      Sets the state image list (from which application-defined state images are taken).                  

      Image list assigned with this method will **not**  be deleted by :ref:`wx.TreeCtrl`'s destructor, you must delete it yourself. 

                


      :param `imageList`: 
      :type `imageList`: wx.ImageList






      .. seealso:: :meth:`AssignStateImageList` .   








   .. method:: SetWindowStyle(self, styles)

      Sets the mode flags associated with the display of the tree control.                  

      The new mode takes effect immediately. 

                


      :param `styles`: 
      :type `styles`: long






      .. note:: 

         Generic only; MSW ignores changes.   








   .. method:: SortChildren(self, item)

      Sorts the children of the given item using :meth:`OnCompareItems` .                  

      You should override that method to change the sort order (the default is ascending case-sensitive alphabetical order). 

                


      :param `item`: 
      :type `item`: wx.TreeItemId






      .. seealso:: :ref:`TreeItemData`, :meth:`OnCompareItems`     








   .. method:: Toggle(self, item)

      Toggles the given item between collapsed and expanded states.                  


      :param `item`: 
      :type `item`: wx.TreeItemId







   .. method:: ToggleItemSelection(self, item)

      Toggles the given item between selected and unselected states.                  

      For multiselection controls only.                  


      :param `item`: 
      :type `item`: wx.TreeItemId







   .. method:: Unselect(self)

      Removes the selection from the currently selected item (if any).                   





   .. method:: UnselectAll(self)

      This function either behaves the same as :meth:`Unselect`   if the control doesn't have  ``TR_MULTIPLE``   style, or removes the selection from all items if it does have this style.                    





   .. method:: UnselectItem(self, item)

      Unselects the given item.                  

      This works in multiselection controls only.                  


      :param `item`: 
      :type `item`: wx.TreeItemId







   .. attribute:: BoundingRect

      See :meth:`~wx.TreeCtrl.GetBoundingRect`


   .. attribute:: Count

      See :meth:`~wx.TreeCtrl.GetCount`


   .. attribute:: EditControl

      See :meth:`~wx.TreeCtrl.GetEditControl`


   .. attribute:: FirstVisibleItem

      See :meth:`~wx.TreeCtrl.GetFirstVisibleItem`


   .. attribute:: FocusedItem

      See :meth:`~wx.TreeCtrl.GetFocusedItem` and :meth:`~wx.TreeCtrl.SetFocusedItem`


   .. attribute:: ImageList

      See :meth:`~wx.TreeCtrl.GetImageList` and :meth:`~wx.TreeCtrl.SetImageList`


   .. attribute:: Indent

      See :meth:`~wx.TreeCtrl.GetIndent` and :meth:`~wx.TreeCtrl.SetIndent`


   .. attribute:: QuickBestSize

      See :meth:`~wx.TreeCtrl.GetQuickBestSize` and :meth:`~wx.TreeCtrl.SetQuickBestSize`


   .. attribute:: RootItem

      See :meth:`~wx.TreeCtrl.GetRootItem`


   .. attribute:: Selection

      See :meth:`~wx.TreeCtrl.GetSelection`


   .. attribute:: Selections

      See :meth:`~wx.TreeCtrl.GetSelections`


   .. attribute:: StateImageList

      See :meth:`~wx.TreeCtrl.GetStateImageList` and :meth:`~wx.TreeCtrl.SetStateImageList`

