[PyQt] KIntNumInput question

Jim Bublitz jbublitz at nwinternet.com
Sun Dec 21 17:45:02 GMT 2008


On Sunday 21 December 2008 07:40:25 am Neal Becker wrote:
>         num_in = KIntNumInput (self, 0, 0, 16)
>
> gives:
> TypeError: too many arguments to KIntNumInput(), 1 at most expected
>
> But according to
> http://api.kde.org/pykde-4.1-api/kdeui/KIntNumInput.html#obj175289196
>
> There are constructors taking 1,2, and 3 args.  What am I missing? 
> Is there some other doc I should be looking at?

The docs you linked are a little confusing. If you were calling __init__ 
directly, you'd pass 'self'. But since you're calling the constructor 
instead, the 'self' argument isn't used.

Since KIntNumInput is ultimately a subclass of QWidget, sip appears to 
be choosing the single argument constructor - KIntNumInput (QWidget), 
where the QWidget is 'self', and for that constructor only a single 
argument is passed.

If you drop the 'self' argument, it should work.

Seems like the docs should show you how to put together a constructor 
properly.

Jim


More information about the PyQt mailing list