我正在尝试通过 Notepad++ 运行一个 pyqt4 示例。我之前问过这个问题(运行 PyQt4 示例代码时什么都没有发生),最终卸载了 Enthought Canopy 和 python 的所有残余并安装了 cygwin。现在,当我运行示例代码时,我从 npp 的控制台收到以下错误。nppExec 命令 --> C:\cygwin\bin\python2.7.exe -i "$(FULL_CURRENT_PATH)"
。示例代码一直显示在底部。
我能得到的最接近的是启动 cygwin x(从 bash shell 键入 startx),我可以在其中显示示例窗口,尽管我无法退出窗口。
我觉得我在这里不知所措,我只想创建一些简单的 GUI,我正在努力让一个例子工作。Cygwin的python安装是否缺少经典的IDLE?
C:\cygwin\bin\python2.7.exe -i "C:\Users\Brian\Dropbox\Python\PYqt_practice.py"
Process started >>>
cygwin warning:
MS-DOS style path detected: C:\Users\Brian\Dropbox\Python\PYqt_practice.py
Preferred POSIX equivalent is: /cygdrive/c/Users/Brian/Dropbox/Python/PYqt_practice.py
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
C:\Users\Brian\Dropbox\Python\PYqt_practice.py: cannot connect to X server
<<< Process finished. (Exit code 1)
================ READY ================
PyQt4 示例代码
import sys
from PyQt4 import QtGui
def main():
app = QtGui.QApplication(sys.argv)
w = QtGui.QWidget()
w.resize(250, 150)
w.move(300, 300)
w.setWindowTitle('Simple')
w.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()