[PyQt] Re: KIntNumInput question

Phil Thompson phil at riverbankcomputing.com
Mon Dec 22 00:41:48 GMT 2008


On Sun, 21 Dec 2008 17:22:03 -0500, Neal Becker <ndbecker2 at gmail.com>
wrote:
> Jim Bublitz wrote:
> 
>> 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
>         num_in = KIntNumInput (0, 0, 16)
> TypeError: argument 2 of KIntNumInput() has an invalid type

If you want to pass a NULL pointer use None rather than 0.

Phil


More information about the PyQt mailing list