The DataViewCtrl
control allows a flexible way to display rich data. The DataViewCtrl
control can use different data model classes to represent and provide data to the view that can then present the data, such as ListCtrl
or TreeCtrl
. In this recipe, we will take a look at getting started with DataViewCtrl
by creating a custom DataViewModel
class to provide data to the control.
Perform the following steps:
First, we need to import an extra module as
DataViewCtrl
and related classes are in a submodule of thewx
namespace:import inspect import wx import wx.dataview as dv
Next, let's define a Python object that will be our data model. This class will be used to represent the structure of class inheritance for a Python object, as follows:
class HierarchyInfo: def __init__(self, item, parent): self.item = item self.parent = parent self.name = item.__name__ self.docs = item.__doc__ if self.docs: self.docs = self...