So, I am trying to run a very simple program (a window) in Pycharm that is running anaconda 2.7 & PyQt4. Whenever I click the Run
button it opens my program but closes the window too fast for me to even see it. May anyone, please help? Thank you!
P.S.
I'm very new to programming.
{__author__ = 'Jay'
import sys
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()
window.show()}
You need to block the execution of the program after you call
window.show()
so that thewindow
object remains active otherwise it will be garbage collected.app.exec_()
does this for you.