tree drop target: can't work this out

with this source:

···

----
$ cat t.py
import wx

class TC(wx.PyDropTarget):
    def __init__(self):
        wx.PyDropTarget.__init__(self)
class TRC(wx.TreeCtrl,TC):
    def __init__(self,pa,id,sy):
        TC.__init__(self)
        wx.TreeCtrl.__init__(self,pa,id,sy)

TRC(None,None,None)
----

i get this error:
$ python t.py
Traceback (most recent call last):
  File "t.py", line 11, in ?
    TRC(None,None,None)
  File "t.py", line 8, in __init__
    TC.__init__(self)
  File "t.py", line 5, in __init__
    wx.PyDropTarget.__init__(self)
  File "C:\Python24\Lib\site-packages\wx-2.6-msw-unicode\wx\_misc.py", line 5502
, in __init__
    self._setCallbackInfo(self, DropTarget)
  File "C:\Python24\Lib\site-packages\wx-2.6-msw-unicode\wx\_controls.py", line
5337, in _setCallbackInfo
    return _controls_.TreeCtrl__setCallbackInfo(*args, **kwargs)
TypeError: argument number 1: a 'wxPyTreeCtrl *' is expected, 'PySwigObject(_p_w
xPyDropTarget)' is received

versions:
----
$ python
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import wx
wx.__version__

'2.6.3.3'

ta,

jack

See the wxPython demo on how to properly create drop targets for drag
and drop. Hint: it's not by making your tree control a subclass of
wx.PyDropTarget . Also, only top-level windows (wx.Frame and wx.Dialog)
can be created with a parent of None.

- Josiah

···

"Jack Andrews" <effbiae@gmail.com> wrote:

with this source:
----
$ cat t.py
import wx

class TC(wx.PyDropTarget):
    def __init__(self):
        wx.PyDropTarget.__init__(self)
class TRC(wx.TreeCtrl,TC):
    def __init__(self,pa,id,sy):
        TC.__init__(self)
        wx.TreeCtrl.__init__(self,pa,id,sy)

TRC(None,None,None)

Josiah Carlson wrote:

with this source:
----
$ cat t.py
import wx

class TC(wx.PyDropTarget):
    def __init__(self):
        wx.PyDropTarget.__init__(self)
class TRC(wx.TreeCtrl,TC):
    def __init__(self,pa,id,sy):
        TC.__init__(self)
        wx.TreeCtrl.__init__(self,pa,id,sy)

TRC(None,None,None)

See the wxPython demo on how to properly create drop targets for drag
and drop. Hint: it's not by making your tree control a subclass of
wx.PyDropTarget . Also, only top-level windows (wx.Frame and wx.Dialog)
can be created with a parent of None.

Also, the classes produced by the SWIG used in version 2.6.3.3 and before has problems with multiple inheritance of SWIG objects. They both have a 'this' attribute that handles the connection to the C++ class instance and with typechecking. Combining them both in a single Python class will cause the conflict you saw.

With the version of SWIG I used for 2.7 has supposedly solved this problem, but I haven't tested it.

···

"Jack Andrews" <effbiae@gmail.com> wrote:

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