Package wx :: Package lib :: Module combotreebox
[frames | no frames]

Module wx.lib.combotreebox

ComboTreeBox provides a ComboBox that pops up a tree instead of a list.

ComboTreeBox tries to provide the same interface as 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 TreeItemId associated with the added item is returned. You can then use that 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 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.

Author: Frank Niessink <> Copyright 2006, 2008, Frank Niessink License: wxWidgets license Version: 1.0 Date: May 2, 2008

Function Summary
  ComboTreeBox(*args, **kwargs)
Factory function to create the right ComboTreeBox depending on platform.

Function Details

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

Generated by Epydoc 2.1.20050511.rpd on Mon Feb 16 12:53:16 2009