[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Issue with QValidator
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2016-12-22 17:27:16
Message-ID: 24E86BDE-05BB-4FEE-997E-75794130A1A9 () riverbankcomputing ! com
[Download RAW message or body]

On 22 Dec 2016, at 5:18 pm, Thomas Daniel <tomek.daniel@gmail.com> wrote:
> 
> Here is the simple test script:
> 
> #!/usr/bin/env python3
> 
> from PyQt5.QtWidgets import *
> from PyQt5.QtGui     import *
> from PyQt5.QtCore    import *
> 
> import sys
> 
> class Validator(QValidator):
>    def __init__(self, parent = None):
>        super().__init__(parent)
>    def validate(self, name, pos):
>        return QValidator.Acceptable
> 
> class Widget(QDialog):
>    def __init__(self, parent = None):
>        super().__init__(parent)
>        line_edit = QLineEdit(self)
>        line_edit.setValidator(Validator())
> 
> app     = QApplication(sys.argv)
> widget  = Widget()
> widget.show()
> app.exec_()
> 
> 
> Running the script results in
> TypeError: invalid result from Validator.validate()
> 
> Testing with PyQt5.7 on ubuntu 16.04, installed with apt-get install
> python3-pyqt5.
> 
> I can't figure out what I am doing wrong!

help(QValidator.validate)

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic