Example #1
0
 def setPhoto(self, pixmap=None):
     self._zoom = 0
     if pixmap and not pixmap.isNull():
         self._empty = False
         self.setDragMode(QtWidgets.QGraphicsView.ScrollHandDrag)
         self._photo.setPixmap(pixmap)
     else:
         self._empty = True
         self.setDragMode(QtWidgets.QGraphicsView.NoDrag)
         self._photo.setPixmap(QtCore.QPixmap())
     self.fitInView()
Example #2
0
 def __init__(self, place, path, width, partner):
     super().__init__(place)
     self.partner = partner
     pixmap = QtCore.QPixmap(path).scaledToWidth(
         width, QtCore.Qt.SmoothTransformation)
     playspace = partner.width() - width
     self.random = random.randint(0, playspace)
     t.pos(self, size=pixmap)
     t.style(self, background=TRANSPARENT)
     self.setPixmap(pixmap)
     self.show()