I am building an PyQt5 app with QWebEngineView. The html file is read by BeautifulSoup, which prettifies it then show it using QtWebEngineView. My code is like the following:
class HTMLRenderer(QWebEngineView):
def __init__(self):
super(HTMLRenderer, self).__init__(parent)
self.soup = BeautifulSoup(open('../template/email.html', 'r').read(), 'html.parser')
self.render()
def render(self):
self.setHtml(self.soup.prettify())
self.show()
But the QtWebEngineView is blank. It fails to show anything.
I'm developing on Windows 7. The whole code works on Mac OS. But now I want to have it worked on Windows 7.
It seems that QWebEngineView has problems on Windows.
Thank you for your advice.
I managed to "skip" this bug by pasting the entire url path. Seems that relative paths dont get rendered.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.