I am newbie to Qt GUI and I am trying to run this very simple script using PyQt4 on Python 2.7.11. The problem is that when I run the script the window is displayed but when I click on it I get a not responding message.
import sys
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()
window.setGeometry(50, 50, 500, 300)
window.setWindowTitle('Preview')
window.show()
Note: I am on a windows 10 machine.
You must add app.exec_()
at the end. This will start the Qt event loop.
import sys
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()
window.setGeometry(50, 50, 500, 300)
window.setWindowTitle('Preview')
window.show()
app.exec_()
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments