So the only thing that comes into my head is to use a widget that renders html itself, exactly as it is proposed in the code you posted.
Making some changes, I managed to have a similar result in GNU / Linux:
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QUrl
from PyQt5.QtWebEngineWidgets import QWebEngineView
app = QApplication(sys.argv)
web = QWebEngineView()
html = '<!doctype html><html><head></head><body><iframe width="560" height="315" src="https://www.youtube.com/embed/zqFPTkxu-Rc"frameborder="0" allowfullscreen></iframe></body></html>'
url = QUrl("https://www.youtube.com/")
web.setHtml(html, url)
web.show()
app.exec()
The difference is that in version 5, there is no longer the QString class, and you can use standard Python strings instead.
In addition, instead of using the QWebView
widget, I used QWebEngineView
which, according to documentation , replaces QWebKit for more current support of HTML, CSS and Javascript. However, according to the same source, you may have trouble using this widget on windows.
If this is the case for you, maybe you should change your library. wxPython has html support, I just do not know how they support it for Python 3. In addition, you can take a look at GTK + , which also has a webkit that can solve your problem.