1

I have tried probably everything and it did not work at all. This is my code:

import sys
from pprint import pprint
from PyQt5.QtWidgets import (QtWidgets, QPushButton, QLineEdit, QApplication)

class MyWindow(QWidget):
    def __init__(self):
        super().__init__()
        self.btn = QPushButton('Open', self)
        self.btn.move(0, 20)
        self.btn.clicked.connect(self.showDialog)

        self.text_name = QLineEdit(self)
        self.text_name.move(100,22)
        self.text_name.setPlaceholderText("Enter your name:")

        self.setGeometry(300, 300, 290, 140)
        self.setWindowTitle("Input dialog example")

    def showDialog(self):
        text, result = QInputDialog.getText(self, 'Input Dialog', 'Enter your name:')
        if result == True:
            self.text_name.setText(str(text))

if __name__ == '__main__':
    app = QApplication(sys.argv)
    pprint("input parameters = " + str(sys.argv))
    my_window = MyWindow()
    my_window.show()
    sys.exit(app.exec_())

And this is the error:

error

I uninstalled and installed Python 3.7, I updated pip, I uninstalled and installed PyQt5 two times already. I have restarted my computer multiple times and still couldn't find a soultion. Feel free to ask me anything that could help you solve my problem.

ekhumoro
  • 115,249
  • 20
  • 229
  • 336
Grecu Alex
  • 71
  • 1
  • 9
  • 2
    insert you code and error messages as text, not as screenshots. – Alex P. Oct 06 '19 at 12:10
  • There are multiple answers here: https://stackoverflow.com/questions/42863505/dll-load-failed-when-importing-pyqt5 Including some that you didn't mention trying – Ofer Sadan Oct 06 '19 at 12:11
  • I tried them before and none of those worked unfortunatley – Grecu Alex Oct 06 '19 at 12:14
  • Are you in a virtual enviroment? Did you verify that you have `Python3.dll` in the correct folder? Did you try to downgrade the version of PyQt? – Ofer Sadan Oct 06 '19 at 12:16
  • ```C:\Users\Alex\AppData\Local\Programs\Python\Python37``` the python3.dll is in this folder. I dont have a virtual env and no i didnt try to downgrade the version of pyQt – Grecu Alex Oct 06 '19 at 12:20
  • I have downgraded the version now to 5.12 and it did not work. – Grecu Alex Oct 06 '19 at 12:50

0 Answers0