Last active
November 4, 2015 15:43
-
-
Save estan/5a85040c594b92d0bae2 to your computer and use it in GitHub Desktop.
Application won't quit on last window closed with qtreactor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/qtreactor/qt4base.py b/qtreactor/qt4base.py | |
index 076599e..88af08c 100644 | |
--- a/qtreactor/qt4base.py | |
+++ b/qtreactor/qt4base.py | |
@@ -273,7 +273,8 @@ class QtReactor(posixbase.PosixReactorBase): | |
else: | |
self._blockApp = QtCore.QEventLoop() | |
self.runReturn() | |
- self._blockApp.exec_() | |
+ #self._blockApp.exec_() | |
+ self.qApp.exec_() | |
class QtEventReactor(QtReactor): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
from sys import argv | |
from PyQt4.QtGui import QMessageBox, QApplication | |
import qt4reactor | |
if __name__ == '__main__': | |
app = QApplication(argv) | |
app.lastWindowClosed.connect(lambda: print('Last window closed')) | |
qt4reactor.install() | |
box = QMessageBox(QMessageBox.Information, 'Test', 'Running with Qt reactor') | |
box.show() | |
from twisted.internet import reactor | |
reactor.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
from sys import argv, exit | |
from PyQt4.QtGui import QMessageBox, QApplication | |
if __name__ == '__main__': | |
app = QApplication(argv) | |
app.lastWindowClosed.connect(lambda: print('Last window closed')) | |
box = QMessageBox(QMessageBox.Information, 'Test', 'Running without Qt reactor') | |
box.show() | |
exit(app.exec_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment