The part where webpage should be rendered gets white for a fraction of second and then gets empty
Here is my code (basically it is https://www.pythonguis.com/examples/python-web-browser/):
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtWebEngineWidgets import *
import sys
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow,self).__init__(*args, **kwargs)
self.browser = QWebEngineView()
self.browser.setUrl(QUrl("https://www.google.com"))
self.setCentralWidget(self.browser)
self.show()
app = QApplication(sys.argv)
window = MainWindow()
app.exec_()
Here is similar code, which I use for rendering html in from my local folder (also does not work - same symptoms):
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtWebEngineWidgets import *
import sys
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow,self).__init__(*args, **kwargs)
self.browser = QWebEngineView()
file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'temporary_files', "map.html"))
self.browser.load(QUrl.fromLocalFile(file_path))
self.setCentralWidget(self.browser)
self.show()
app = QApplication(sys.argv)
window = MainWindow()
app.exec_()
PyQt5.15.6, python3.8, OS Ubuntu 22.04 LTS. It worked before on ubuntu 18.04, problems started after reinstalling system, although I backed up and restored virtual environment, so libraries should be the same.