Re: QMessageBox.question returns NoButton in python interactive
Thomas Caswell <[email protected]>
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <CAA48SF-nZ9uFZqp9h_2V6=AKORVD7auOt6cWr1XtPvspY8NQ4w@mail.gmail.com> |
I suspect, but can not prove, that this is related to PyOS_InputHook and may depend on exactly which terminal emulator you are using on windows. Tom On Thu, Jun 27, 2019 at 3:01 PM Kyle Altendorf <[email protected]> wrote: > Seems to work ok in 5.9.2 and 5.12.1 in Linux here. I get 16384 (Yes) and > 65536 (No). > > Though this is an odd program. I thought message boxes maybe ran their > own event loop if needed but is showing a button and expecting it's signals > to emit functionally really proper? > > Cheers, > > -kyle > > > On 2019-06-27 14:36, Luke Campagnola wrote: > > Greetings, > I have found that when calling QMessageBox.question, the message box > flashes up briefly before disappearing and the call returns NoButton. This > behavior is present in both PyQt4 and PyQt5 (most recently tested on 5.9.2 > from anaconda package), on windows (but not linux), and only if I have not > called QApplication.exec_() because I am running in an interactive python > shell. > > Code to reproduce (run with python -i): > > import sys > #from PyQt4 import QtGui as QtWidgets > from PyQt5 import QtWidgets > > app = QtWidgets.QApplication([]) > > def msg(): > print(QtWidgets.QMessageBox.question(btn, "title", "message")) > > btn = QtWidgets.QPushButton("show messagebox") > btn.clicked.connect(msg) > btn.show() > > # message box works if event loop is started > # app.exec_() > > > Cheers, > Luke > > _______________________________________________ > PyQt mailing list [email protected] > https://www.riverbankcomputing.com/mailman/listinfo/pyqt > > _______________________________________________ > PyQt mailing list [email protected] > https://www.riverbankcomputing.com/mailman/listinfo/pyqt > -- Thomas Caswell [email protected] _______________________________________________ PyQt mailing list [email protected] https://www.riverbankcomputing.com/mailman/listinfo/pyqt