[Tutor] wxPython issues
Alan Gauld
alan.gauld at btinternet.com
Mon Apr 18 19:10:01 CEST 2011
"Eric Stevens" <element.effect at gmail.com> wrote
> prototype pages. Right now, I am trying to create a
> wx.ScrolledWindow class
I would strongly recommend not calling your class the same
as the standard widget. I don't think thats causing
issues here but I wouldn't be surprised! Its a bit like overrriding
built-in Python functions. Users of wxPython expect "ScrolledWindow"
to refer to the standard one...
> understanding, I have. (The full Exception Error is below). I have
> attatched
> a text file with a copy of my program.
Being picky, you attached an RTF file which mostly won't
cause a problem, but you might as well just have attached
the original python code since it truly is a text file! And that
way there is no chance of anything getting clipped or
distorted during the cut n paste or import/conversion process
> File "C:\Python27\programming\wxPython practice", line 34, in
> <module>
> frame= RandomFrame(None, -1, 'Random')
> File "C:\Python27\programming\wxPython practice", line 29, in
> __init__
> listpage = ScrolledWindow(panel, -1)
> File "C:\Python27\programming\wxPython practice", line 9, in
> __init__
> wx.ScrolledWindow.__init__(self)
> File
> "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_windows.py",
> line 145, in __init__
>
> _windows_.ScrolledWindow_swiginit(self,_windows_.new_ScrolledWindow(*args,
> **kwargs))
> TypeError: Required argument 'parent' (pos 1) not found
Your code looks like:
class ScrolledWindow(wx.ScrolledWindow):
def __init__(self, parent, id, style = wx.LC_REPORT):
wx.ScrolledWindow.__init__(self)
Notice that you do not pass the parent etc onto the superclass
constructor.
You need something like:
wx.ScrolledWindow.__init__(self, parent, id, style)
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list