Question

I'd like PyQt to load an image and display it from the web. Dozens of examples I've found online did not work, as they are for downloading the image.

I simply want to view it.

Something like

from PyQt4.QtWebKit import *
web = QWebView()
web.load(QUrl("http://stackoverflow.com/content/img/so/logo.png"))
Was it helpful?

Solution

import sys
from PyQt4 import QtCore, QtGui, QtWebKit

app = QtGui.QApplication(sys.argv) 

web = QtWebKit.QWebView()
web.load(QtCore.QUrl("http://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png"))
web.show()

sys.exit(app.exec_()) 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top