Argument issue in QCompleter

Gottfried Müller gottfried.mueller at
Fri Jul 9 07:40:27 BST 2021


in the Qt documentation the parent argument is a keyword. Creating an
instance with QCompleter(QStandardItemModel, parent=parentObj) brings an

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):
         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()
     return appl.exec_()

if __name__ == "__main__":


More information about the PyQt mailing list