0

I was attempting to implement the code from this question, but I have discovered that QTimer does not fire under certain circumstances.

The simplified code:

app = QApplication([])

view = QWebEngineView()
view.show()

def callback():
    sys.exit(0)

QTimer.singleShot(1000, callback)

app.exec()

The application runs forever with this code (ie. callback is never executed). However, if you comment out view.show() then it exits after one second as it should.

As far as I can tell, this problem is particular to QWebEngineView; if we replace the QWebEngineView with a generic QWidget or QLabel, then it works as expected and exits after one second.

What is the cause of this, and how can I fix it?

8
  • 1
    How strange I have tested the code in Python 3.8.1, PyQt5 5.14.1 on Linux and it works correctly. Commented Mar 11, 2020 at 1:54
  • 1
    Maybe it's a bug, try other versions of pyqt5. Commented Mar 11, 2020 at 1:56
  • 1
    Where do you run your code: CMD or the interactive python console or some IDE? Commented Mar 11, 2020 at 1:57
  • 1
    mmm, I think it's a bug, try earlier versions of pyqt5 and pyqtwebengine. Are you using the same version of pyqt5 and pyqtwebengine? Commented Mar 11, 2020 at 2:00
  • 1
    You better publish it. :-) Commented Mar 11, 2020 at 2:18

1 Answer 1

0

As prompted by @eyllanesc, I have discovered that this is a bug introduced by the 5.14.0 release of the PyQtWebEngine module; the previous version (5.13.2) does not show this behavior.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.