PyQtWebEngine dont't show nothing - python

I'm trying to create a mini web browser, but I'm having some problems with PyQtWebEngine. When I run the code the window appear but It's blank, that window don't show me the page (In this case of test I'm trying to connect with Google).
I've already tried to reinstall PyQt5, PyQtWebEngine and I've already create a Virtual Enviroment with venv (as I see here) but seems that nothing could fix it.
I run the code with debug mode with F5 and run using QT_DEBUG_PLUGINS=1 but they show me no errors.
This is the code (I'm just following this example)
import sys
from PyQt5.QtCore import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv)
web = QWebEngineView()
web.load(QUrl('https://google.it/'))
web.show()
sys.exit(app.exec_())
And this is the window when I run the code
I'm editing this code with Microsoft Visual Code, running on Ubuntu 22.04.1.

I got the same problem with your code on Linux Mint 21 (based on Ubuntu 22.04).
Even other examples from tutorials had the same problem.
this answer helped me to resolve this problem. I describe it with more details.
I got all installed modules for PyQt5
pip3 freeze | grep -i pyqt
PyQt5==5.15.7
PyQt5-Qt5==5.15.2
PyQt5-sip==12.11.0
PyQtWebEngine==5.15.6
PyQtWebEngine-Qt5==5.15.2
and I unistalled all of them
pip3 uninstall PyQt5 PyQt5-Qt5 PyQt5-sip PyQtWebEngine PyQtWebEngine-Qt5
And later I installed QtWebEngine using apt
(apt automatically installed also PyQt5 and I didn't need to use pip for this)
apt install python3-pyqt5.qtwebengine
It installed also other C/C++ libraries - and maybe this was needed to work corrrectly.
The following additional packages will be installed:
libqt5designer5 libqt5qml5 libqt5qmlmodels5 libqt5quick5 libqt5quickwidgets5 libqt5test5 libqt5webchannel5
libqt5webengine-data libqt5webengine5 libqt5webenginecore5 libqt5webenginewidgets5 libre2-9 python3-pyqt5
python3-pyqt5.qtwebchannel python3-pyqt5.sip
And now pip3 freeze shows me:
PyQt5==5.15.6
PyQt5-sip==12.9.1
PyQtWebEngine==5.15.5
And now your code works for me.
Similar questions:
python - Unable to render webpage using QWebEngineView - Stack Overflow
python 3.x - PyQt5 QWebEngineView does not show webpage - Stack Overflow
python - Displaying web page with PyQt5 WebEngine - Stack Overflow

Related

PyQt5 Installation

I am new to the world of python and I was hoping you could help with my PyQt5 installation troubles.
I have downloaded PyQt5 (zip folder) for Windows and extracted onto my desktop.
Source: https://www.riverbankcomputing.com/software/pyqt/download5
As instructed in the read me file, I have also installed the latest SIP package (also extracted to the desktop) and I have run the configure.py in python 3.5 to receive the following error:
Error: Use the --qmake argument to explicitly specify a working Qt qmake.
Does anyone know why this may be? Or how I fix it and complete the install?
Additionally, I have watched a tutorial on YouTube... https://www.youtube.com/watch?v=JBME1ZyHiP8
However when trying to run his code (shown below) I get the:
'ImportError: No module named 'PyQt5'
Is this linked to the install issues?
Code:
import sys
from PyQt5 import QtGui
app = QtGui.QApplication (sys.argv)
window = QtGui.Qwidget()
window.setGeometry (50, 50, 800, 500)
window.setWindowTitle("GIS Demonstration")
window.show()
Am I missing something? All solutions welcome.
Thanks,
Jodie
I install it with the cmd (shell):
pip install pyqt5
this works for my

PyQt5: How to make pyqtgraph work on Debian OS?

I have already installed PyQt5 on my respberry pi 3, and I need pyqtgraph to do live plotting. I have tried to install pyqtgraph using either pip install, or download debian version of pyqtgraph from its official websites, but it just doesn't work. Actually, it is successfully installed, but when I run my program, it just automatically quit without any error message. Also when I comment out the lines related to pyqtgraph, everything goes well. Can someone explain what is wrong with debian/linux version of pyqtgraph?

QT Webengine for Ubuntu

I have several different qt packages installed for my development environment on Ubuntu 15.04 (3.19.0-51-generic), and I can't seem to get my imports correct. The error I am running into in PyCharm is:
from PyQt5.QtWebEngineWidgets import QWebEnginePage
ImportError: No module named 'PyQt5.QtWebEngineWidgets'
The following packages I have installed already, which I believe to be relevant are as follows:
python3-pyqt5
python3-pyqt5-dbg
python-pyqt5
python-pyqt5-dbg
pyqt5-dev-tools
pyqt5-dev
python-pyqt5.qtwebkit
python3-pyqt5.qtwebkit
python-pyqt5.qtwebkit-dbg
python3-pyqt5.qtwebkit-dbg
What am I missing here? Note that the project explicitly requires the following in its README:
Qt 5.5+
PyQt5.6+
Furthermore, I understand that webengine and webkit are two different things (I was giving it a stab). I can't find any Webengine for PyQT5 anywhere in the official Vivid repository. I tried installing libqt5webengine5-dev and libqt5webengine5 from https://launchpad.net/~ethereum/+archive/ubuntu/ethereum-qt packages with the same result, perhaps I need to add something to Python path. Can anyone lend a hand (Im normally a .NET developer :/)?

No autocomplete for PyQt4 in PyCharm

On my office PC I'm using
Python 3.4
PyQt4 Version 4.11.1
PyCharm Community Eddition 3.4.1
I installed everything in the order as stated above.
However, code completion does not work. It works for imports, but not for classes and methods.
I made a small sample program:
import sys
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()
window.setWindowTitle("Test")
window.resize(300, 200)
window.show()
sys.exit(app.exec_())
In the code above none of the classes or methods were suggested by PyCharm.
If I type window.setW I would expect it to suggest setWindowTitle() but it doesn't.
Strange thing is, that I'm using the same setup on my computer at home and there it works like a (Py)charm... Autocompletion, auto imports, etc. As far as I remember I installed it the same way as I did on my office PC.
I already looked at some similiar questions but this question has no answers and others don't contain relevant information that helped me so far.
Don't know if it is relevant but at this line
from PyQt4 import QtGui
PyCharm tells me
Unresolved reference 'QtGui'
Maybe the reason for this is the same.
I had the same problem on Linux, pyqt5 and pycharm CE.
The solution was to rebuild the skeletons with:
File > Invalidate Caches / Restart > Invalidate and Restart.
The problem was solved by installing PyCharm first and then Python and PyQt.
Afterwards I had to configure the interpreter in PyCharm and it worked.
When I posted the question I installed Python, then PyQt and then PyCharm.
Oddly enough, it worked in this order on another PC.
I went through the same issue recently. Unfortunately, the install order didn't solve it for me.
There is a bug report here. Downloading the Early Access Program release worked and can be found here

PyQT5 Python 3.3 Pycharm

I am new to python and I have an issue running PyQT5 for my Python 3.3 on PyCharm.
I have read several posts about it, some speaking about doing a build which I am not sure to get.
Here is what I have done :
Downloaded and run the .exe found here.
Installing normally, the same way as my Pillow for instance (which is running with my Pycharm).
aaaand, that's its.
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
== from PyQt5.QtCore import *
ImportError: No module named 'PyQt5.QtCore'
When I setup the module in PyCharm it simply didn't find it. So is the .exe found on the official PyQT5 dead ?
Thanks
Bloby
I also met the same problem recently, maybe you also install PyQt5 by pip?
It seems that the after using pip, I can import the PyQt5 but not any packages of it, so I have to download the old version with an installer.
Then Pycharm can runs without error.

Categories

Resources