0
我想直接從http://i.ytimg.com/直接閱讀縮略圖,而不使用谷歌gdata服務。誰能幫我?如何檢索縮略圖並將其顯示爲QListwidget項目?
`enter code here`
#!/usr/bin/env python
#_*_ encoding: UTF-8 _*_
from PyQt4.QtGui import QImageReader
from PyQt4.QtNetwork import (QNetworkRequest, QNetworkReply, QNetworkAccessManager)
from PyQt4.QtCore import QUrl
def getThumbnails(self,numTitles):
thumbs = []
thumbs[:]= []
nam = QNetworkAccessManager()
for i in xrange(numTitles):
url = QUrl("http://i.ytimg.com/vi/" + self.tubeLinks[i] + "/default.jpg")
request = QNetworkRequest(url)
reply = nam.get(request)
image_reader = QImageReader(reply)
thumbs.append(image_reader.read())
return thumbs
我delimmas是:
1.-如何測試拇指是否被成功讀取?
2.-如何將它們添加到QListWidget項目使用pixmap?