.. 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
.. _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

Inheritance diagram for class
DataViewTreeCtrl:
|
|appearance| Control Appearance
===============================
|
.. container:: control-appearance-figures
.. figure:: _static/images/widgets/fullsize/wxmsw/wx.dataview.dataviewtreectrl.png
:alt: wxMSW
:figclass: appearance-figure
**wxMSW**
.. figure:: _static/images/widgets/fullsize/wxmac/wx.dataview.dataviewtreectrl.png
:alt: wxMAC
:figclass: appearance-figure
**wxMAC**
.. figure:: _static/images/widgets/fullsize/wxgtk/wx.dataview.dataviewtreectrl.png
:alt: wxGTK
:figclass: appearance-figure
**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.GetClassDefaultAttributes`
: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.GetItemParent` Returns the item's parent.
: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() -> None
DataViewTreeCtrl(parent : Window, id: int=ID_ANY, pos:
Point=DefaultPosition, size: Size=DefaultSize, style:
int=DV_NO_HEADER|DV_ROW_LINES, validator: Validator=DefaultValidator) ->
None
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:**
:html:`
`
**__init__** `(self)`
Default constructor.
:rtype: `None`
:html:`
`
**__init__** `(self, parent : Window, id: int=ID_ANY, pos: Point=DefaultPosition, size: Size=DefaultSize, style: int=DV_NO_HEADER|DV_ROW_LINES, validator: 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
:rtype: `None`
:html:`
`
.. method:: AppendContainer(self, parent : DataViewItem, text : str, icon: int=-1, expanded: int=-1, data: Optional[ClientData]=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 : DataViewItem, text : str, icon: int=-1, data: Optional[ClientData]=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 : Window, id: int=ID_ANY, pos: Point=DefaultPosition, size: Size=DefaultSize, style: int=DV_NO_HEADER|DV_ROW_LINES, validator: 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`.
:rtype: `None`
.. method:: DeleteChildren(self, item : DataViewItem)
Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:rtype: `None`
.. method:: DeleteItem(self, item : DataViewItem)
Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:rtype: `None`
.. method:: GetChildCount(self, parent : DataViewItem)
Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:param `parent`:
:type `parent`: wx.dataview.DataViewItem
:rtype: `int`
.. staticmethod:: GetClassDefaultAttributes(variant: WindowVariant=WINDOW_VARIANT_NORMAL)
:param `variant`:
:type `variant`: wx.WindowVariant
:rtype: `VisualAttributes`
.. method:: GetImageList(self)
Returns the image list.
:rtype: `ImageList`
.. method:: GetItemData(self, item : DataViewItem)
Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:rtype: `ClientData`
.. method:: GetItemExpandedIcon(self, item : DataViewItem)
Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:rtype: `Icon`
.. method:: GetItemIcon(self, item : DataViewItem)
Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:rtype: `Icon`
.. method:: GetItemParent(self, item : DataViewItem)
Returns the item's parent.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:rtype: :ref:`wx.dataview.DataViewItem`
.. versionadded:: 4.1/wxWidgets-3.1.6
.. method:: GetItemText(self, item : DataViewItem)
Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:rtype: `str`
.. method:: GetNthChild(self, parent : DataViewItem, pos : int)
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 : DataViewItem, previous : DataViewItem, text : str, icon: int=-1, expanded: int=-1, data: Optional[ClientData]=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 : DataViewItem, previous : DataViewItem, text : str, icon: int=-1, data: Optional[ClientData]=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 : DataViewItem)
Returns ``True`` if item is a container.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:rtype: `bool`
.. method:: PrependContainer(self, parent : DataViewItem, text : str, icon: int=-1, expanded: int=-1, data: Optional[ClientData]=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 : DataViewItem, text : str, icon: int=-1, data: Optional[ClientData]=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 : ImageList)
Sets the image list.
:param `imagelist`:
:type `imagelist`: wx.ImageList
:rtype: `None`
.. method:: SetItemData(self, item : DataViewItem, data : ClientData)
Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:param `data`:
:type `data`: ClientData
:rtype: `None`
.. method:: SetItemExpandedIcon(self, item : DataViewItem, icon : BitmapBundle)
Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:param `icon`:
:type `icon`: wx.BitmapBundle
:rtype: `None`
.. method:: SetItemIcon(self, item : DataViewItem, icon : BitmapBundle)
Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:param `icon`:
:type `icon`: wx.BitmapBundle
:rtype: `None`
.. method:: SetItemText(self, item : DataViewItem, text : str)
Calls the identical method from :ref:`wx.dataview.DataViewTreeStore`.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:param `text`:
:type `text`: string
:rtype: `None`
.. attribute:: ImageList
See :meth:`~wx.dataview.DataViewTreeCtrl.GetImageList` and :meth:`~wx.dataview.DataViewTreeCtrl.SetImageList`
.. attribute:: Store
See :meth:`~wx.dataview.DataViewTreeCtrl.GetStore`