[PyQt] QValidator.validate() returns TypeError: invalid result type

Phil Thompson phil at riverbankcomputing.com
Thu Aug 5 08:36:21 BST 2010


On Wed, 4 Aug 2010 21:22:47 -0400, Eric Frederich
<eric.frederich at gmail.com> wrote:
> Reading the documentation here...
> 
>
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qvalidator.html
> 
> ... I see that the validate() function is listed twice.
> One returning (State, QString, int) and another returning just (State,
int)
> I would think this means I have the choice to return either 2-tuple or a
> 3-tuple.
> 
> Returning a 2-tuple seems to work fine but I get an error trying to
return
> (State, QString, and int)
> 
> Is this a bug, or did I miss something or interpret the documentation
> wrong?

The documentation is describing the API for both the QString v1 and v2
APIs.

The way to get the correct signature for any method is to use help()...

    help(QValidator.validate)

The generated docstrings will be correct (for the default QString API).
Changing the documentation so that it is driven from the same information
is on the TODO list.

Phil


More information about the PyQt mailing list