I'm trying to create a custom control based on wx.richtext.RichTextCtrl
and I'm running into a problem. Whenever I attempt to add the custom control to a sizer, wxPython chokes with the error
Traceback (most recent call last):
File "pyebook.py", line 46, in <module>
frame = MainFrame(None, 'pyebook')
File "pyebook.py", line 14, in __init__
self.mainPanel.GetSizer().Add(ReaderControl(self.mainPanel), 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
File "/usr/local/lib/wxPython-unicode-2.8.11.0/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 12685, in Add
return _core_.Sizer_Add(*args, **kwargs)
TypeError: wx.Window, wx.Sizer, wx.Size, or (w,h) expected for item
The custom control is at this time extremely simple and looks like this
class ReaderControl(wx.richtext.RichTextCtrl):
def __init__(self, parent, id=-1, value=''):
wx.richtext.RichTextCtrl(parent, id, value, style=wx.richtext.RE_READONLY, name='ReaderControl')
The code I'm using to add the control to the sizer is:
self.mainPanel.GetSizer().Add(ReaderControl(self.mainPanel), 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
Any ideas what I'm doing wrong here?