Problem when calling __init__() in base class

Sébastien Cabot sebascabot at sympatico.ca
Mon Dec 3 17:54:16 EST 2001


(With Python2.1.1, on Debian, with Python megawidget)

We have the following in the class 'ScrolledFrame' of the Pmw.

class ScrolledFrame(Pmw.MegaWidget):
    def __init__(self, parent = None, **kw):
    ...

In my inherited class, I call __init__() of the base class
'Pmw.ScrolledFrame.'

class MyScrolledFrame(Pmw.ScrolledFrame):
  def __init__(self, parent, **kw):
    Pmw.ScrolledFrame.__init__(self, parent, kw)
    ...

Then I get this error:

...
    Pmw.ScrolledFrame.__init__(self, parent, kw)
TypeError: __init__() takes at most 2 arguments (3 given)

What I'm doing wrong ?
Where's my third arguments now ?


Here's my test code which raise the error

#--- test.py ----------------------------------------

import Tkinter
import Pmw

class MyScrolledFrame(Pmw.ScrolledFrame):
  def __init__(self, parent, **kw):
    Pmw.ScrolledFrame.__init__(self, parent, kw)

if __name__ == '__main__':
  root = Tkinter.Tk()
  Pmw.initialise(root)

  MyScrolledFrame(root, labelpos="n", label_text="Special").pack()








More information about the Python-list mailing list