This program crashes when the class mixin is
a new-style class subclassed from object. It
works fine when it's defined as an old style
class object.
Can anybody explain what's going on?
···
----------------------------
#!/usr/local/bin/python2.2
from wxPython.wx import *
#class mixin: is ok!
class mixin(object): #this causes problems!
def __init__(self):
pass
class MyFrame(wxFrame, mixin):
def __init__(self, parent, ID, title, pos=wxDefaultPosition,
size=wxDefaultSize, style=wxDEFAULT_FRAME_STYLE):
wxFrame.__init__(self, parent, ID, title, pos, size, style)
panel = wxPanel(self, -1)
EVT_CLOSE(self, self.OnCloseWindow)
def OnCloseWindow(self, event):
self.Destroy()
class theApp(wxApp):
def OnInit(self):
self.main=MyFrame(None, -1, "This is a test")
self.main.Show(true)
return true
def main():
application = theApp(0)
application.MainLoop()
if __name__ == '__main__':
main()
--------------------------
Here is the error I get:
python app.py
Traceback (most recent call last):
File "app.py", line 33, in ?
main()
File "app.py", line 29, in main
application = theApp(0)
File "/usr/local/lib/python2.2/site-packages/wxPython/wx.py", line 1705, in
__init__
_wxStart(self.OnInit)
File "app.py", line 24, in OnInit
self.main=MyFrame(None, -1, "This is a test")
File "app.py", line 14, in __init__
wxFrame.__init__(self, parent, ID, title, pos, size, style)
File "/usr/local/lib/python2.2/site-packages/wxPython/frames.py", line 152,
in __init__
self._setOORInfo(self)
File "/usr/local/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.
I'm using python 2.2 and wxPython 2.3.3.1 built
from source.
Thanks!
-Scott Harris