【问题标题】:What is the difference between reactor.run() vs reactor.runReturn() in twisted?扭曲的 reactor.run() 与 reactor.runReturn() 有什么区别?
【发布时间】:2014-07-11 22:03:26
【问题描述】:

这是给我的代码,我不完全确定runReturn的功能是什么,文档似乎有点稀疏。

我怀疑它与reactor.run() 相同,但将线程管理归还给其他地方?

    app=QtGui.QApplication('monitor GUI')  # Create the application
    app.setQuitOnLastWindowClosed(False)
    if reactor is None:  # reactor may be the module twisted.internet.reactor
        import qt4reactor  # Must be after Qt application is created
        qt4reactor.install()

        from twisted.internet import reactor

        reactor.runReturn()

谢谢

【问题讨论】:

  • 我刚刚快速扫描了扭曲的互联网反应堆源,但没有看到 reactor.runReturn 。您是从其他位置装载反应堆吗?
  • 这是一个特殊的 Qt4 反应器。这不是反应堆的正常功能。

标签: python multithreading qt4 twisted reactor


【解决方案1】:

PyQT 应用程序有自己的事件循环,类似于(!)扭曲的反应器。他们俩都阻塞了主循环。换句话说,他们俩都想控制整个代码流。

'使用 qt4reactorreactor.runReturn() 钉子扭曲到 PyQt。从那时起, Twisted 的行为与 Qt / PyQt 一样正常......上帝的意图。'

【讨论】:

    猜你喜欢
    • 2023-04-08
    • 2011-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-19
    • 2013-03-14
    • 2018-09-14
    相关资源
    最近更新 更多