Using property in classic class may not work
Robin Dunn
robin at alldunn.com
Tue Apr 15 20:00:35 EDT 2003
I have it on my ToDo list for figuring out how what exactly the problem
is (I have a general idea) and fixing it. Not sure when I'll get to it
though, hopefully soon...
--Robin
Neil Hodgson wrote:
> [With some editing to isolate the points]
>
> [Neil Hodgson]
> The class in question is derived from a wxWindows class, so I can't
> make it derive just from object. The "What's New in Python 2.2"
> document only mentions property wrt new-style clases.
>
> [A. Lloyd Flanagan]
> However, the last time I tried to subclass from both wxFrame and
> object, wxPython freaked out (that's a technical term for "I don't
> remember what happened, but boy, it sure didn't work").
> Not sure about the latest version of wxPython, though -- there's
> binaries for python 2.3 out by now. I'll have to try it again..
>
> [Alex Martelli]
> If wxPython keeps freaking, you may have to give up on properties
> if you HAVE to inherit its classes (can't just wrap with automatic
> delegation) and go back to "good old" (yeah right) __setattr__. Or,
> gently pressure wxPython's maintainers to have them move to
> new-style classes... whatever aspects of old-style classes they
> may be taking for granted at present, migrating to new-style can
> hardly be a major job, in my experience.
>
> [Me again]
> Robin may feel constrained to keep wxPython compatible with multiple
> Python major versions.
> Here is the "freaking out" with wxPython+wxGTK 2.4.0.7 on Python 2.2
> caused by adding 'object' as a second base class to the most derived
> frame class, that is, the class that has the property:
>
> Traceback (most recent call last):
> File "DemonTerm.py", line 1343, in ?
> app = DemonTermApp(sys.argv)
> File "DemonTerm.py", line 1290, in __init__
> wxApp.__init__(self, 0)
> File
> "/usr/local/ActivePython-2.2/lib/python2.2/site-packages/wxPython/wx.py",
> line 1802, in __init__
> _wxStart(self.OnInit)
> File "DemonTerm.py", line 1327, in OnInit
> self.frame = DemonFrame(BasicScreenDefs)
> File "DemonTerm.py", line 577, in __init__
> TerminalGUI.TerminalFrame.__init__(self, screenDefs)
> File "TerminalGUI.py", line 762, in __init__
> style=wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
> File
> "/usr/local/ActivePython-2.2/lib/python2.2/site-packages/wxPython/frames.py",
> line 150, in __init__
> self._setOORInfo(self)
> File
> "/usr/local/ActivePython-2.2/lib/python2.2/site-packages/wxPython/windows.py",
> line 60, in _setOORInfo
> val = apply(windowsc.wxEvtHandler__setOORInfo,(self,) + _args, _kwargs)
> TypeError: Type error in argument 1 of wxEvtHandler__setOORInfo.
> Expected _wxEvtHandler_p.
>
> OOR is wxPythonese for 'Original Object Return' but I don't know what
> that really means.
>
> Neil
>
>
More information about the Python-list
mailing list