PyQt4示例从IDLE工作,但从npp执行时不工作 [英] PyQt4 example working from IDLE, but not when executed from npp

查看:107
本文介绍了PyQt4示例从IDLE工作,但从npp执行时不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在PyQt4中运行一个非常基本的示例.如下所示.我当时在挣扎着Enthought Canopy的安装,在cygwin Python的实施中挣扎,最后才一次安装了Python 2.7,Numpy 1.7.1和M​​atPlotLib 1.2.0.

I am running a very basic example in PyQt4. It is shown below. I was struggling with the Enthought Canopy installation, struggling with the cygwin Python implementation, and finally just installed Python 2.7, Numpy 1.7.1, MatPlotLib 1.2.0 one at a time.

当我从IDLE执行示例时,它工作正常.虽然当我尝试使用nppExec从Notepad ++执行它时,控制台窗口只是挂起.我看不到任何地方都弹出一个空窗口,也没有给出任何错误代码.

When I execute the example from IDLE, it works fine. Although when I try to execute it from Notepad++ using nppExec, the console window just hangs. I do not see a little empty window pop up anywhere, nor am I given any error codes.

  • 我尝试了nppExec(-i)的交互模式和非交互模式
    • 我的nppExec命令是python "$(FULL_CURRENT_PATH)"
    • I tried interactive mode and non-interactive mode from nppExec (-i)
      • My nppExec command is python "$(FULL_CURRENT_PATH)"

      .

      • Python 2.7.4
      • notepad ++ 6.3.2
      • PyQt4 4.10.1

      • Python 2.7.4
      • notepad++ 6.3.2
      • PyQt4 4.10.1

      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('Brian')
          w.show()
      
      sys.exit(app.exec_())
      
      
      if __name__ == '__main__':
          main()
      

    • 推荐答案

      在NppExec中,使用命令

      In NppExec, use the command

      CMD /C python -u "$(FULL_CURRENT_PATH)"
      

      代替

      python "$(FULL_CURRENT_PATH)"
      

      这篇关于PyQt4示例从IDLE工作,但从npp执行时不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆