Reputation: 769
I was trying out PyQt4. and tried this code.
import sys
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()
window.show()
print 'end'
This above code works when i try it on on ipython
, But it doesn’t when i write them into a file and run it. I also tried changing the permission by chmod +x
. The code actually runs(the reason i added a print statement at the end to confirm if the code is running till the end), i don’t get a window.
im running python 2.7.6 on ubuntu 14.04
Upvotes: 1
Views: 2197
Reputation: 11849
You need to start the Qt event loop by calling app.exec_()
once you have initialised the widgets and called show()
on your main window.
Upvotes: 4