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
初始化小部件并在主窗口上调用show()
,需要通过调用app.exec_()
启动Qt事件循环。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.