.. wxPython Phoenix documentation

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

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

.. include:: headings.inc



.. _wx.dataview.DataViewTreeCtrl:

==========================================================================================================================================
|phoenix_title|  **wx.dataview.DataViewTreeCtrl**
==========================================================================================================================================

This class is a :ref:`wx.dataview.DataViewCtrl`  which internally uses a :ref:`wx.dataview.DataViewTreeStore`  and forwards most of its API to that class.          

Additionally, it uses a :ref:`wx.ImageList`  to store a list of icons. 

The main purpose of this class is to provide a simple upgrade path for code using :ref:`wx.TreeCtrl`. 





.. _DataViewTreeCtrl-styles:

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

This class supports the following styles: 

  See :ref:`wx.dataview.DataViewCtrl`  for the list of supported styles.  





.. _DataViewTreeCtrl-events:

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

Event macros for events emitted by this class: 

  See :ref:`wx.dataview.DataViewCtrl`  for the list of events emitted by this class.  







         



.. versionadded:: 2.9.0 
    







|

|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>DataViewTreeCtrl</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.dataview.DataViewTreeCtrl_inheritance.png" alt="Inheritance diagram of DataViewTreeCtrl" 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="69,237,157,267"/> <area shape="rect" id="node7" href="wx.dataview.DataViewCtrl.html" title="wx.dataview.DataViewCtrl" alt="" coords="22,315,204,344"/> <area shape="rect" id="node2" href="wx.Window.html" title="wx.Window" alt="" coords="69,160,157,189"/> <area shape="rect" id="node3" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="5,5,107,35"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="57,83,168,112"/> <area shape="rect" id="node4" href="wx.Object.html" title="wx.Object" alt="" coords="131,5,212,35"/> <area shape="rect" id="node6" href="wx.dataview.DataViewTreeCtrl.html" title="wx.dataview.DataViewTreeCtrl" alt="" coords="9,392,217,421"/> </map> 
   </p>

|


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

|

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

   **wxMSW**


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

   **wxMAC**


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

   **wxGTK**


|


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

================================================================================ ================================================================================
:meth:`~wx.dataview.DataViewTreeCtrl.__init__`                                   Default constructor.
:meth:`~wx.dataview.DataViewTreeCtrl.AppendContainer`                            Appends a container to the given `parent`.
:meth:`~wx.dataview.DataViewTreeCtrl.AppendItem`                                 Appends an item to the given `parent`.
:meth:`~wx.dataview.DataViewTreeCtrl.Create`                                     Creates the control and a :ref:`wx.dataview.DataViewTreeStore`  as its internal model.
:meth:`~wx.dataview.DataViewTreeCtrl.DeleteAllItems`                             Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:meth:`~wx.dataview.DataViewTreeCtrl.DeleteChildren`                             Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:meth:`~wx.dataview.DataViewTreeCtrl.DeleteItem`                                 Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:meth:`~wx.dataview.DataViewTreeCtrl.GetChildCount`                              Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:meth:`~wx.dataview.DataViewTreeCtrl.GetImageList`                               Returns the image list.
:meth:`~wx.dataview.DataViewTreeCtrl.GetItemData`                                Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:meth:`~wx.dataview.DataViewTreeCtrl.GetItemExpandedIcon`                        Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:meth:`~wx.dataview.DataViewTreeCtrl.GetItemIcon`                                Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:meth:`~wx.dataview.DataViewTreeCtrl.GetItemText`                                Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:meth:`~wx.dataview.DataViewTreeCtrl.GetNthChild`                                Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:meth:`~wx.dataview.DataViewTreeCtrl.GetStore`                                   Returns the store.
:meth:`~wx.dataview.DataViewTreeCtrl.InsertContainer`                            Calls the same method from :ref:`wx.dataview.DataViewTreeStore`  but uses an index position in the image list instead of a :ref:`wx.Icon`.
:meth:`~wx.dataview.DataViewTreeCtrl.InsertItem`                                 Calls the same method from :ref:`wx.dataview.DataViewTreeStore`  but uses an index position in the image list instead of a :ref:`wx.Icon`.
:meth:`~wx.dataview.DataViewTreeCtrl.IsContainer`                                Returns ``True`` if item is a container.
:meth:`~wx.dataview.DataViewTreeCtrl.PrependContainer`                           Calls the same method from :ref:`wx.dataview.DataViewTreeStore`  but uses an index position in the image list instead of a :ref:`wx.Icon`.
:meth:`~wx.dataview.DataViewTreeCtrl.PrependItem`                                Calls the same method from :ref:`wx.dataview.DataViewTreeStore`  but uses an index position in the image list instead of a :ref:`wx.Icon`.
:meth:`~wx.dataview.DataViewTreeCtrl.SetImageList`                               Sets the image list.
:meth:`~wx.dataview.DataViewTreeCtrl.SetItemData`                                Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:meth:`~wx.dataview.DataViewTreeCtrl.SetItemExpandedIcon`                        Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:meth:`~wx.dataview.DataViewTreeCtrl.SetItemIcon`                                Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:meth:`~wx.dataview.DataViewTreeCtrl.SetItemText`                                Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
================================================================================ ================================================================================


|


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

================================================================================ ================================================================================
:attr:`~wx.dataview.DataViewTreeCtrl.ImageList`                                  See :meth:`~wx.dataview.DataViewTreeCtrl.GetImageList` and :meth:`~wx.dataview.DataViewTreeCtrl.SetImageList`
:attr:`~wx.dataview.DataViewTreeCtrl.Store`                                      See :meth:`~wx.dataview.DataViewTreeCtrl.GetStore`
================================================================================ ================================================================================


|


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


.. class:: wx.dataview.DataViewTreeCtrl(DataViewCtrl)

   **Possible constructors**::

       DataViewTreeCtrl()
       
       DataViewTreeCtrl(parent, id=ID_ANY, pos=DefaultPosition,
                        size=DefaultSize, style=DV_NO_HEADER|DV_ROW_LINES,
                        validator=DefaultValidator)
       
   
   This class is a DataViewCtrl which internally uses a
   DataViewTreeStore and forwards most of its API to that class.



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



      |overload| Overloaded Implementations:

      **~~~**

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

      
      **__init__** `(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=DV_NO_HEADER|DV_ROW_LINES, validator=DefaultValidator)`
      
      Constructor.                  
      
      Calls :meth:`Create` .                  
      
      
      :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
      
      
      
      
      
      
      **~~~**






   .. method:: AppendContainer(self, parent, text, icon=-1, expanded=-1, data=None)

      Appends a container to the given `parent`.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem
      :param `text`: 
      :type `text`: string
      :param `icon`: 
      :type `icon`: int
      :param `expanded`: 
      :type `expanded`: int
      :param `data`: 
      :type `data`: ClientData




      :rtype: :ref:`wx.dataview.DataViewItem`








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

      Appends an item to the given `parent`.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem
      :param `text`: 
      :type `text`: string
      :param `icon`: 
      :type `icon`: int
      :param `data`: 
      :type `data`: ClientData




      :rtype: :ref:`wx.dataview.DataViewItem`








   .. method:: Create(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=DV_NO_HEADER|DV_ROW_LINES, validator=DefaultValidator)

      Creates the control and a :ref:`wx.dataview.DataViewTreeStore`  as its internal model.                  

      The default tree column created by this method is an editable column using :ref:`wx.dataview.DataViewIconTextRenderer`  as its renderer.                  


      :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




      :rtype: `bool`








   .. method:: DeleteAllItems(self)

      Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.                   





   .. method:: DeleteChildren(self, item)

      Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem







   .. method:: DeleteItem(self, item)

      Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem







   .. method:: GetChildCount(self, parent)

      Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem




      :rtype: `int`








   .. method:: GetImageList(self)

      Returns the image list.                  

      :rtype: :ref:`ImageList`








   .. method:: GetItemData(self, item)

      Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem




      :rtype: :ref:`ClientData`








   .. method:: GetItemExpandedIcon(self, item)

      Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem




      :rtype: :ref:`Icon`








   .. method:: GetItemIcon(self, item)

      Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem




      :rtype: :ref:`Icon`








   .. method:: GetItemText(self, item)

      Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem




      :rtype: `string`








   .. method:: GetNthChild(self, parent, pos)

      Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem
      :param `pos`: 
      :type `pos`: int




      :rtype: :ref:`wx.dataview.DataViewItem`








   .. method:: GetStore(self)

      Returns the store.                  

      :rtype: :ref:`wx.dataview.DataViewTreeStore`








   .. method:: InsertContainer(self, parent, previous, text, icon=-1, expanded=-1, data=None)

      Calls the same method from :ref:`wx.dataview.DataViewTreeStore`  but uses an index position in the image list instead of a :ref:`wx.Icon`.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem
      :param `previous`: 
      :type `previous`: wx.dataview.DataViewItem
      :param `text`: 
      :type `text`: string
      :param `icon`: 
      :type `icon`: int
      :param `expanded`: 
      :type `expanded`: int
      :param `data`: 
      :type `data`: ClientData




      :rtype: :ref:`wx.dataview.DataViewItem`








   .. method:: InsertItem(self, parent, previous, text, icon=-1, data=None)

      Calls the same method from :ref:`wx.dataview.DataViewTreeStore`  but uses an index position in the image list instead of a :ref:`wx.Icon`.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem
      :param `previous`: 
      :type `previous`: wx.dataview.DataViewItem
      :param `text`: 
      :type `text`: string
      :param `icon`: 
      :type `icon`: int
      :param `data`: 
      :type `data`: ClientData




      :rtype: :ref:`wx.dataview.DataViewItem`








   .. method:: IsContainer(self, item)

      Returns ``True`` if item is a container.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem




      :rtype: `bool`








   .. method:: PrependContainer(self, parent, text, icon=-1, expanded=-1, data=None)

      Calls the same method from :ref:`wx.dataview.DataViewTreeStore`  but uses an index position in the image list instead of a :ref:`wx.Icon`.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem
      :param `text`: 
      :type `text`: string
      :param `icon`: 
      :type `icon`: int
      :param `expanded`: 
      :type `expanded`: int
      :param `data`: 
      :type `data`: ClientData




      :rtype: :ref:`wx.dataview.DataViewItem`








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

      Calls the same method from :ref:`wx.dataview.DataViewTreeStore`  but uses an index position in the image list instead of a :ref:`wx.Icon`.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem
      :param `text`: 
      :type `text`: string
      :param `icon`: 
      :type `icon`: int
      :param `data`: 
      :type `data`: ClientData




      :rtype: :ref:`wx.dataview.DataViewItem`








   .. method:: SetImageList(self, imagelist)

      Sets the image list.                  


      :param `imagelist`: 
      :type `imagelist`: wx.ImageList







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

      Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem
      :param `data`: 
      :type `data`: ClientData







   .. method:: SetItemExpandedIcon(self, item, icon)

      Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem
      :param `icon`: 
      :type `icon`: wx.Icon







   .. method:: SetItemIcon(self, item, icon)

      Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem
      :param `icon`: 
      :type `icon`: wx.Icon







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

      Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem
      :param `text`: 
      :type `text`: string







   .. attribute:: ImageList

      See :meth:`~wx.dataview.DataViewTreeCtrl.GetImageList` and :meth:`~wx.dataview.DataViewTreeCtrl.SetImageList`


   .. attribute:: Store

      See :meth:`~wx.dataview.DataViewTreeCtrl.GetStore`

