Argument issue in QCompleter
Gottfried Müller
gottfried.mueller at gmx.de
Fri Jul 9 07:40:27 BST 2021
Hello,
in the Qt documentation the parent argument is a keyword. Creating an
instance with QCompleter(QStandardItemModel, parent=parentObj) brings an
error.
I am using Python 3.9.5 and PyQt5 5.15
Here my code:
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QCompleter
from PyQt5.QtGui import QStandardItemModel
class ApplWindow(QWidget):
def __init__(self, parent=None):
super().__init__(parent)
QCompleter(["aaaa", "bbbb"], parent=self)
# the following statement has the execution error:
# TypeError: 'parent' is an unknown keyword argument
#QCompleter(QStandardItemModel(parent=self), parent=self)
# this statement is accepted
QCompleter(QStandardItemModel(parent=self), self)
def main():
appl = QApplication(sys.argv)
applWindow = ApplWindow()
applWindow.show()
return appl.exec_()
if __name__ == "__main__":
main()
Gottfried
More information about the PyQt
mailing list