[PyKDE] trouble extending QValidate
Erik Myllymaki
erik at pacific-shores.com
Thu Nov 29 04:38:02 GMT 2001
I am trying to extend QValidate. I want to make a date validator function
eventually, but first I am just trying to make something simple work:
class QDateValidator(QValidator):
def __init__(self,*args):
apply(QValidator.__init__, (self,) + args)
def validate(self,input,num):
"""
what's num for ???
"""
print input
if (input == 'ppp'):
return self.Acceptable
elif(input =='pp' or input == 'p'):
return self.Intermediate
else:
return self.Invalid
I get:
TypeError: Invalid result type from QValidator.validate()
from ANY input.
I looked at the return type from the given validators, and it is a tuple:
(0,0) = Invalid
(1,0) = Intermediate
(2,0) = Acceptable
Yet the enums Invalid, Intermediate and Acceptable are 0,1,and 2 resp.
Any help appreciated.
More information about the PyQt
mailing list