Search code examples
pythonpyqt5qtwidgets

Not Responding when using PyQt


I just began to learn PyQt5 in python and the window which opens becomes not respondingenter image description here

import sys
import PyQt5
from PyQt5 import QtWidgets
from PyQt5 import QtCore
x=QtWidgets.QApplication(sys.argv)
y=QtWidgets.QWidget()
y.show()

Solution

  • Try adding the following line to the end of your code:

    sys.exit(x.exec_())
    

    I would also recommend following a tutorial such as this one as PyQt does have a framework which needs to be followed closely. (http://zetcode.com/gui/pyqt5/firstprograms/)