.. 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 .. module:: wx.lib.combotreebox .. currentmodule:: wx.lib.combotreebox .. highlight:: python .. _wx.lib.combotreebox: ========================================================================================================================================== |phoenix_title| **wx.lib.combotreebox** ========================================================================================================================================== ComboTreeBox provides a ComboBox that pops up a tree instead of a list. ComboTreeBox tries to provide the same interface as :class:`wx.ComboBox` as much as possible. However, whereas the ComboBox widget uses indices to access items in the list of choices, ComboTreeBox uses TreeItemId's instead. If you add an item to the ComboTreeBox (using Append or Insert), the :class:`wx.TreeItemId` associated with the added item is returned. You can then use that `wx.TreeItemId` to add items as children of that first item. For example:: from wx.lib.combotreebox import ComboTreeBox combo = ComboTreeBox(parent) item1 = combo.Append('Item 1') # Add a root item item1a = combo.Append('Item 1a', parent=item1) # Add a child to item1 You can also add client data to each of the items like this:: item1 = combo.Append('Item 1', clientData=somePythonObject) item1a = combo.Append('Item 1a', parent=item1, clientData=someOtherPythonObject) And later fetch the client data like this:: somePythonObject = combo.GetClientData(item1) To get the client data of the currently selected item (if any):: currentItem = combo.GetSelection() if currentItem: somePythonObject = combo.GetClientData(currentItem) Supported styles are the same as for :class:`wx.ComboBox`, i.e. ``wx.CB_READONLY`` and ``wx.CB_SORT``. Provide them as usual:: combo = ComboTreeBox(parent, style=wx.CB_READONLY|wx.CB_SORT) Supported platforms: wxMSW and wxMAC natively, wxGTK by means of a workaround. .. moduleauthor:: Frank Niessink Copyright 2006, 2008, 2010, Frank Niessink License: wxWidgets license Version: 1.1 Date: August 1, 2010 |function_summary| Functions Summary ==================================== ================================================================================ ================================================================================ :func:`~wx.lib.combotreebox.ComboTreeBox` Factory function to create the right ComboTreeBox depending on ================================================================================ ================================================================================ | |class_summary| Classes Summary =============================== ================================================================================ ================================================================================ `~wx.lib.combotreebox.BaseComboTreeBox` BaseComboTreeBox is the base class for platform specific versions of the `~wx.lib.combotreebox.BasePopupFrame` BasePopupFrame is the base class for platform specific versions of the `~wx.lib.combotreebox.GTKComboTreeBox` The ComboTreeBox widget for wxGTK. This is actually a work `~wx.lib.combotreebox.GTKPopupFrame` GTKPopupFrame is the base class GTK PopupFrame. `~wx.lib.combotreebox.IterableTreeCtrl` TreeCtrl is the same as :class:`TreeCtrl`, with a few convenience methods `~wx.lib.combotreebox.MACPopupFrame` MacPopupFrame is the base class Mac PopupFrame. `~wx.lib.combotreebox.MSWComboTreeBox` MSWComboTreeBox adds one piece of functionality as compared to `~wx.lib.combotreebox.MSWPopupFrame` MSWPopupFrame is the base class Windows PopupFrame. `~wx.lib.combotreebox.NativeComboTreeBox` NativeComboTreeBox, and any subclass, uses the native ComboBox as basis, ================================================================================ ================================================================================ | .. toctree:: :maxdepth: 1 :hidden: wx.lib.combotreebox.BaseComboTreeBox wx.lib.combotreebox.BasePopupFrame wx.lib.combotreebox.GTKComboTreeBox wx.lib.combotreebox.GTKPopupFrame wx.lib.combotreebox.IterableTreeCtrl wx.lib.combotreebox.MACPopupFrame wx.lib.combotreebox.MSWComboTreeBox wx.lib.combotreebox.MSWPopupFrame wx.lib.combotreebox.NativeComboTreeBox Functions ------------ .. function:: ComboTreeBox(\*args, \*\*kwargs) Factory function to create the right ComboTreeBox depending on platform. You may force a specific class, e.g. for testing purposes, by setting the keyword argument 'platform', e.g. 'platform=GTK' or 'platform=MSW' or 'platform=MAC'. :keyword string `platform`: 'GTK'|'MSW'|'MAC' can be used to override the actual platform for testing