O'Reilly logo

WxPython Application Development Cookbook by Cody Precord

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Modeling your data

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.

How to do it…

Perform the following steps:

  1. First, we need to import an extra module as DataViewCtrl and related classes are in a submodule of the wx namespace:
    import inspect
    import wx
    import wx.dataview as dv
  2. 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required