Issue
how can i set Qicon from a url in PYQT , can you give me an example?
Solution
a basic example would be:
from PyQt4.QtGui import *
from PyQt4.QtCore import QUrl
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest
app = QApplication([])
url = "http://www.google.com/favicon.ico"
lbl = QLabel("loading...")
nam = QNetworkAccessManager()
def finishRequest(reply):
img = QImage()
img.loadFromData(reply.readAll())
lbl.setPixmap(QPixmap(img))
nam.finished.connect(finishRequest)
nam.get(QNetworkRequest(QUrl(url)))
lbl.show()
app.exec_()
Answered By - mata
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.