So, the only thing that comes to mind is to use a widget that renders html properly, exactly as is proposed in the code you posted.
Making some modifications, I managed to get a very similar result on 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, so you can use standard Python strings instead.
Also, instead of using the widget QWebView
, I used the QWebEngineView
which, according to the documentation, replaces Qwebkit for more current HTML, CSS and Javascript support. However, according to the same source, you may have problems using this widget in windows.
If this is your case, you might want to switch libraries. The wxPython has html support, just do not know how is their support for Python 3. Besides it, you can take a look at GTK+, that also has a Webkit that can solve your problem.
Dude, the Qwebview class, which is the most important one in this case, also exists in Pyqt5. Try to update Imports.
– ppalacios