wxTreeListCtrl

In response to a helpful message on this list, I was returning to a project
with the hope of using the wxListCtrlAutoWidthMixin with a wxTreeListCtrl.
My understanding of this was that I should inherit from wxTreeListCtrl and
wxListCtrlAutoWidthMixin and pass values to the appropriate constructors.
Please bear with me, I'm new to both Python and wxPython, so I'm struggling
a little.

I haven't found any sample code with the wxTreeListCtrl and
wxListCtrlAutoWidthMixin working in concert, so if anyone can provide any
advice, I'd be most appreciative.

I've got this code:

  from wxPython.wx import *
  from wxPython.gizmos import *
  from wxPython.lib.mixins.listctrl import wxColumnSorterMixin,
wxListCtrlAutoWidthMixin

  class OrgasmTreeList(wxTreeListCtrl, wxListCtrlAutoWidthMixin):
      def __init__(self,parent,id,style):
          wxTreeListCtrl(self,id,style)
          wxListCtrlAutoWidthMixin.__init__(self)

which generates this error:

  Traceback (most recent call last):
    File "<stdin>", line 102, in ?
    File "C:\Python23\lib\site-packages\wx\core.py", line 5042, in __init__
      self._BootstrapApp()
    File "C:\Python23\lib\site-packages\wx\core.py", line 4791, in
_BootstrapApp
      return _core.PyApp__BootstrapApp(*args, **kwargs)
    File "<stdin>", line 98, in OnInit
    File "<stdin>", line 45, in __init__
    File "<stdin>", line 17, in __init__
    File "C:\Python23\lib\site-packages\wx\gizmos.py", line 420, in __init__
      newobj = _gizmos.new_TreeListCtrl(*args, **kwargs)
  TypeError: Expected a pointer

Of course, the above code isn't invoked until this line:

  remoteTree = OrgasmTreeList(self.splitter,cID,style=TREE_STYLE)

which replaced this line (which still works fine when not commented out):

  remoteTree = wxTreeListCtrl(self.splitter,cID,style=TREE_STYLE)

Greg McClure

Greg McClure wrote:

In response to a helpful message on this list, I was returning to a project
with the hope of using the wxListCtrlAutoWidthMixin with a wxTreeListCtrl.
My understanding of this was that I should inherit from wxTreeListCtrl and
wxListCtrlAutoWidthMixin and pass values to the appropriate constructors.
Please bear with me, I'm new to both Python and wxPython, so I'm struggling
a little.

I haven't found any sample code with the wxTreeListCtrl and
wxListCtrlAutoWidthMixin working in concert, so if anyone can provide any
advice, I'd be most appreciative.

I've got this code:

  from wxPython.wx import *
  from wxPython.gizmos import *
  from wxPython.lib.mixins.listctrl import wxColumnSorterMixin,
wxListCtrlAutoWidthMixin

  class OrgasmTreeList(wxTreeListCtrl, wxListCtrlAutoWidthMixin):
      def __init__(self,parent,id,style):
          wxTreeListCtrl(self,id,style)

You need to use

    wxTreeListCtrl.__init__(self, id, style=style)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!