Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Type errors using QInputDialog()
I am cutting and pasting examples that work into my app and I get these errors.
bq. Traceback (most recent call last):
File "/home/me/scripts/ghf/ghf.py", line 295, in bkill
TypeError: 'PySide.QtGui.QInputDialog.getText' called with wrong argument types:
PySide.QtGui.QInputDialog.getText(Ui_StatCheck, str, str, PySide.QtGui.QLineEdit.EchoMode, unicode)
PySide.QtGui.QInputDialog.getText(PySide.QtGui.QWidget, unicode, unicode, PySide.QtGui.QLineEdit.EchoMode = QLineEdit.Normal, unicode = QString(), PySide.QtCore.bool, PySide.QtCore.Qt.WindowFlags = 0)
PySide.QtGui.QInputDialog.getText(PySide.QtGui.QWidget, unicode, unicode, PySide.QtGui.QLineEdit.EchoMode, unicode, PySide.QtCore.bool, PySide.QtCore.Qt.WindowFlags, PySide.QtCore.Qt.InputMethodHints)
The python code for the GUI is generated by pyside-uic and it defines a class as "class Ui_MainWindow(object):"
I've noticed in the example I am using the class is defined as "class Dialog(QtGui.QDialog):" so I am assuming that is the root of my problem.
This is the function definition from the example;
text, ok = QtGui.QInputDialog.getText(self, "QInputDialog.getText()",
"User name:", QtGui.QLineEdit.Normal,
if ok and text != '':
The function is called with "pushButton.clicked.connect(self.setText)". Since my signal is part of an 'object' class instead of a 'QtGui.Qdialog' class how do I invoke an input dialog?
I found another method for getting the required input.
Still curious how to pass the proper types to QInputDialog but at least I'm not DIW on my project.
Thanks to all.
Replaced 'self' with 'MainWindow' and the function worked.