本文整理匯總了Python中PySide.QtGui.QPixmap.fromImage方法的典型用法代碼示例。如果您正苦於以下問題:Python QPixmap.fromImage方法的具體用法?Python QPixmap.fromImage怎麽用?Python QPixmap.fromImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PySide.QtGui.QPixmap
的用法示例。
在下文中一共展示了QPixmap.fromImage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: play
# 需要導入模塊: from PySide.QtGui import QPixmap [as 別名]
# 或者: from PySide.QtGui.QPixmap import fromImage [as 別名]
def play(self):
self._finished = 0
path = "%s/%s" % (self._save_dir, self._options['uri'])
rect = self._widget.geometry()
self._img.load(path)
self._img = self._img.scaled(rect.width(), rect.height(),
Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
self._widget.setPixmap(QPixmap.fromImage(self._img))
self._widget.show()
self._widget.raise_()
self._play_timer.setInterval(int(float(self._duration) * 1000))
self._play_timer.start()
self.started_signal.emit()
示例2: toqpixmap
# 需要導入模塊: from PySide.QtGui import QPixmap [as 別名]
# 或者: from PySide.QtGui.QPixmap import fromImage [as 別名]
def toqpixmap(im):
# # This doesn't work. For now using a dumb approach.
# im_data = _toqclass_helper(im)
# result = QPixmap(im_data['im'].size[0], im_data['im'].size[1])
# result.loadFromData(im_data['data'])
# Fix some strange bug that causes
if im.mode == 'RGB':
im = im.convert('RGBA')
qimage = toqimage(im)
return QPixmap.fromImage(qimage)