pythonqtpyqtqwebviewqwebelement

Qt Image From Web


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"))

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_())