4

I encountered some problems with the use of the library QtWebEngineWidgets. The main idea is to display PDF in a QWebEngineView, so I want firstly to display simply a web page like https://google.com.

I tested a lot of code from different websites and forums but I have always the same problem, the PyQt page show nothing.

I would like to get your attention to a code from codeloop (https://codeloop.org/python-how-to-make-browser-in-pyqt5-with-pyqtwebengine/)

import sys
from PyQt5.Qt import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtWidgets import QApplication

app = QApplication(sys.argv)

web = QWebEngineView()

web.load(QUrl("https://google.com"))

web.show()

sys.exit(app.exec_())

( I chose this because it's a simple code and illustrate perfectly the problem that I encounter all the time )

Code and page

I remain open to all your answers and comments.

{EDIT} I have : PyQt5 5.15.0 PyQt5-sip 12.8.0 PyQtWebEngine 5.15.0

enter image description here

(Dialog box: The application failed to start correctly)

8
  • What version of pyqt5 and pyqtwebengine do you have installed? you could run your script from CMD/console Commented Jul 26, 2020 at 15:56
  • did u consider the dialogue boxes? the code works fine. may be some problem with the istallation Commented Jul 26, 2020 at 16:05
  • Thank for your answer @eyllanesc, I edited my post with the versions. I found an error when I launch the program: I put a screenshot in my post. edit: you talk about a dialog box like in my screenshot ? Commented Jul 26, 2020 at 16:06
  • @FabienDenoyelle I don't understand the error message, can you translate to english? Also try install pyqt5 pyqtwebengine older: python -m pip install pyqt5==5.14.0 pyqtwebengine==5.14.0 Commented Jul 26, 2020 at 16:10
  • It had no influence, I still have the same error message. Commented Jul 26, 2020 at 16:18

1 Answer 1

1

Thanks to @eyllanesc, in fact the problem is with permissions. By creating a virtual environment according to the python documentation (https://docs.python.org/3/tutorial/venv.html), my program work perfectly.

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.